1010
1111class Github (object ):
1212
13+ """Interface to GitHub's API v2."""
14+
1315 def __init__ (self , username = None , api_token = None , requests_per_second = None ,
1416 access_token = None , cache = None , proxy_host = None ,
1517 proxy_port = 8080 , github_url = None ):
16- """
17- An interface to GitHub's API:
18- http://develop.github.com/
18+ """Setup GitHub API object.
1919
2020 .. versionadded:: 0.2.0
2121 The ``requests_per_second`` parameter
@@ -42,6 +42,7 @@ def __init__(self, username=None, api_token=None, requests_per_second=None,
4242 default to 8080 if a proxy_host is set and no port is set).
4343 :param str github_url: the hostname to connect to, for GitHub
4444 Enterprise support
45+
4546 """
4647
4748 self .request = GithubRequest (username = username , api_token = api_token ,
@@ -59,59 +60,65 @@ def __init__(self, username=None, api_token=None, requests_per_second=None,
5960 self .pull_requests = PullRequests (self .request )
6061
6162 def project_for_user_repo (self , user , repo ):
62- """Return GitHub identifier for a user's repository
63+ """Return GitHub identifier for a user's repository.
6364
6465 :param str user: repository owner
6566 :param str repo: repository name
67+
6668 """
6769 return "/" .join ([user , repo ])
6870
6971 def get_all_blobs (self , project , tree_sha ):
70- """Get a list of all blobs for a specific tree
72+ """Get a list of all blobs for a specific tree.
7173
7274 .. versionadded:: 0.3.0
7375
7476 :param str project: GitHub project
7577 :param str tree_sha: object ID of tree
78+
7679 """
7780 blobs = self .request .get ("blob/all" , project , tree_sha )
7881 return blobs .get ("blobs" )
7982
8083 def get_blob_info (self , project , tree_sha , path ):
81- """Get the blob for a file within a specific tree
84+ """Get the blob for a file within a specific tree.
8285
8386 :param str project: GitHub project
8487 :param str tree_sha: object ID of tree
8588 :param str path: path within tree to fetch blob for
89+
8690 """
8791 blob = self .request .get ("blob/show" , project , tree_sha , path )
8892 return blob .get ("blob" )
8993
9094 def get_tree (self , project , tree_sha ):
91- """Get tree information for a specifc tree
95+ """Get tree information for a specifc tree.
9296
9397 :param str project: GitHub project
9498 :param str tree_sha: object ID of tree
99+
95100 """
96101 tree = self .request .get ("tree/show" , project , tree_sha )
97102 return tree .get ("tree" , [])
98103
99104 def get_network_meta (self , project ):
100- """Get GitHub metadata associated with a project
105+ """Get GitHub metadata associated with a project.
101106
102107 :param str project: GitHub project
108+
103109 """
104110 return self .request .raw_request ("/" .join ([self .request .github_url ,
105111 project ,
106112 "network_meta" ]), {})
107113
108114 def get_network_data (self , project , nethash , start = None , end = None ):
109- """Get chunk of GitHub network data
115+ """Get chunk of GitHub network data.
110116
111117 :param str project: GitHub project
112118 :param str nethash: identifier provided by :meth:`get_network_meta`
113119 :param int start: optional start point for data
114120 :param int stop: optional end point for data
121+
115122 """
116123 data = {"nethash" : nethash }
117124 if start :
0 commit comments