mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Get repo from full name: tests, doc, fix param name (Pull #121)
This commit is contained in:
@@ -13,6 +13,11 @@ What's new?
|
||||
|
||||
[](http://travis-ci.org/jacquev6/PyGithub)
|
||||
|
||||
Next version
|
||||
------------
|
||||
|
||||
* Add a shortcut function `Github.get_repo` to get a repo directly from its full name. thank you [lwc](https://github.com/lwc) for the contribution
|
||||
|
||||
[Version 1.9.1](https://github.com/jacquev6/PyGithub/issues?milestone=17&state=closed) (November 20th, 2012)
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ API `/rate_limit`
|
||||
|
||||
API `/repos/:user/:repo`
|
||||
========================
|
||||
* GET: `AuthenticatedUser.get_repo`, `NamedUser.get_repo` or `Organization.get_repo`
|
||||
* GET: `AuthenticatedUser.get_repo`, `NamedUser.get_repo`, `Organization.get_repo` or `Github.get_repo`
|
||||
* PATCH: `Repository.edit`
|
||||
* DELETE: `Repository.delete`
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ Methods
|
||||
* `get_user()`: `AuthenticatedUser`
|
||||
* `get_user( login )`: `NamedUser`
|
||||
* `get_organization( login )`: `Organization`
|
||||
* `get_repo( full_name )`: `Repository`
|
||||
* `get_gist( id )`: `Gist`
|
||||
* `id`: string
|
||||
* `get_gists()`: `PaginatedList` of `Gist`
|
||||
|
||||
+3
-3
@@ -70,11 +70,11 @@ class Github(object):
|
||||
)
|
||||
return Organization.Organization(self.__requester, data, completed=True)
|
||||
|
||||
def get_repo(self, path):
|
||||
assert isinstance(path, (str, unicode)), name
|
||||
def get_repo(self, full_name):
|
||||
assert isinstance(full_name, (str, unicode)), full_name
|
||||
headers, data = self.__requester.requestAndCheck(
|
||||
"GET",
|
||||
"/repos/" + path,
|
||||
"/repos/" + full_name,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
@@ -92,3 +92,6 @@ class Github(Framework.TestCase):
|
||||
self.assertEqual(hook.supported_events, ["push"])
|
||||
self.assertEqual(hook.events, ["push"])
|
||||
self.assertEqual(hook.schema, [["string", "url"], ["string", "token"], ["string", "project_id"], ["string", "milestone_id"], ["string", "category_id"]])
|
||||
|
||||
def testGetRepoFromFullName(self):
|
||||
self.assertEqual(self.g.get_repo("jacquev6/PyGithub").description, "Python library implementing the full Github API v3")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4939'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"922c0519f2733063a899619ae95ce892"'), ('date', 'Sun, 20 May 2012 12:33:27 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-19T10:50:39Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":18,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-19T10:50:39Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490,"mirror_url":null}
|
||||
|
||||
Reference in New Issue
Block a user