Structures

Developed for github3.py

As of right now, there exists only one class in this section, and it is of only limited importance to users of github3.py. The GitHubIterator class is used to return the results of calls to almost all of the calls to iter_ methods on objects. When conditional refreshing was added to objects, there was a noticable gap in having conditional calls to those iter_ methods. GitHub provides the proper headers on those calls, but there was no easy way to add that to what github3.py returned so it could be used properly. This was the best compromise - an object the behaves like an iterator regardless but can also be refreshed to get results since the last request conditionally.

Objects

class github3.structs.GitHubIterator(count, url, cls, session, params=None, etag=None, headers=None)

The GitHubIterator class powers all of the iter_* methods.

as_dict()

Return the attributes for this object as a dictionary.

This is equivalent to calling:

json.loads(obj.as_json())
Returns:this object’s attributes serialized to a dictionary
Return type:dict
as_json()

Return the json data for this object.

This is equivalent to calling:

json.dumps(obj.as_dict())
Returns:this object’s attributes as a JSON string
Return type:str
cls = None

Class for constructing an item to return

count = None

Number of items left in the iterator

etag = None

The ETag Header value returned by GitHub

from_dict(json_dict)

Return an instance of this class formed from json_dict.

from_json(json)

Return an instance of this class formed from json.

headers = None

Headers generated for the GET request

last_response = None

The last response seen

last_status = None

Last status code received

last_url = None

Last URL that was requested

original = None

Original number of items requested

params = None

Parameters of the query string

ratelimit_remaining

Number of requests before GitHub imposes a ratelimit.

Returns:int
url = None

URL the class used to make it’s first GET

class github3.structs.SearchIterator(count, url, cls, session, params=None, etag=None, headers=None)

This is a special-cased class for returning iterable search results.

It inherits from GitHubIterator. All members and methods documented here are unique to instances of this class. For other members and methods, check its parent class.

as_dict()

Return the attributes for this object as a dictionary.

This is equivalent to calling:

json.loads(obj.as_json())
Returns:this object’s attributes serialized to a dictionary
Return type:dict
as_json()

Return the json data for this object.

This is equivalent to calling:

json.dumps(obj.as_dict())
Returns:this object’s attributes as a JSON string
Return type:str
from_dict(json_dict)

Return an instance of this class formed from json_dict.

from_json(json)

Return an instance of this class formed from json.

items = None

Items array returned in the last request

ratelimit_remaining

Number of requests before GitHub imposes a ratelimit.

Returns:int
total_count = None

Total count returned by GitHub