forked from ask/python-github2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusers.py
More file actions
35 lines (24 loc) · 1.15 KB
/
users.py
File metadata and controls
35 lines (24 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from github2.core import BaseData, GithubCommand
class User(BaseData):
attributes = ("id", "login", "name", "company", "location",
"email", "blog", "following_count", "followers_count",
"public_gist_count", "public_repo_count",
"total_private_repo_count", "collaborators",
"disk_usage", "owned_private_repo_count",
"private_gist_count", "plan")
def is_authenticated(self):
return self.plan is not None
class Users(GithubCommand):
domain = "user"
def search(self, query):
return self.make_request("search", query, filter="users")
def show(self, username):
return self.get_value("show", username, filter="user", datatype=User)
def followers(self, username):
return self.make_request("show", username, "followers", filter="users")
def following(self, username):
return self.make_request("show", username, "following", filter="users")
def follow(self, other_user):
return self.make_request("follow", other_user)
def unfollow(self, other_user):
return self.make_request("unfollow", other_user)