3.3 KiB
You don't normaly create instances of any class but Github.
You obtain instances through calls to search_, get_ and create_ methods.
Methods returning an "iterator of SomeType" return an iterator which yields instances of SomeType.
This implements lazy pagination requests.
You can use this iterator in a for f in user.get_followers(): loop or with any itertools functions,
but you cannot know the number of objects returned before the end of the iteration.
If that's really what you need, you cant use len( list( user.get_followers() ) ), which does all the requests needed to enumerate the user's followers.
Note that there is often an attribute giving this value (in that case user.followers).
Class Github
Constructed from user's login and password or OAuth token or nothing:
g = Github( login, password )
g = Github( token )
g = Github()
You can add an argument base_url = "http://my.enterprise.com:8080/path/to/github" to connect to a local install of Github (ie. Github Enterprise).
Another argument, that can be passed is timeout which has default value 10.
Attributes
rate_limiting: tuple of two integers: remaining and limit, as explained in Rate Limiting
Methods
get_user():AuthenticatedUserget_user( login ):NamedUserget_organization( login ):Organizationget_gist( id ):Gistid: string
get_gists(): iterator ofGistsearch_repos( keyword ): iterator ofRepositorylegacy_search_repos( keyword, [language] ): iterator ofRepositorykeyword: stringlanguage: string
legacy_search_users( keyword ): iterator ofNamedUserkeyword: string
legacy_search_user_by_email( email ):NamedUseremail: string
render_markdown( text, [context] ): stringtext: stringcontext:Repository
Class GithubException
Attributes
status: integerdata: dict
{% for class in classes|dictsort:"name" %}
Class {{ class.name }}
======={% for char in class.name %}={% endfor %}=
Attributes
{% for attribute in class.attributes|dictsort:"name" %}* {{ attribute.name }}{% include "ReferenceOfClasses.Type.md" with type=attribute.type only %}
{% endfor %}
{% regroup class.methods|dictsort:"group" by group as method_groups %}
{% for method_group in method_groups %}
{{ method_group.grouper|capfirst }} {% for letter in method_group.grouper %}-{% endfor %}
{% for method in method_group.list %}
{{ method.name|join:"_" }}({% include "ReferenceOfClasses.Parameters.md" with function=method only %}){% include "ReferenceOfClasses.Type.md" with type=method.type only %}
{% for parameter in method.mandatoryParameters %}
* {{ parameter.name }}{% include "ReferenceOfClasses.Type.md" with type=parameter.type only %}
{% endfor %}
{% for parameter in method.optionalParameters %}
* {{ parameter.name }}{% include "ReferenceOfClasses.Type.md" with type=parameter.type only %}
{% endfor %}
{% if method.variadicParameter %}
* {{ method.variadicParameter.name }}{% include "ReferenceOfClasses.Type.md" with type=method.variadicParameter.type only %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}