diff options
-rw-r--r-- | github3/api.py | 1 | ||||
-rw-r--r-- | github3/handlers/base.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/github3/api.py b/github3/api.py index bf0ebe2..1c467ff 100644 --- a/github3/api.py +++ b/github3/api.py @@ -11,6 +11,7 @@ from handlers import users, gists RESOURCES_PER_PAGE = 100 +#TODO: refactor: loads json in request editing Response object class GithubCore(object): """ Wrapper to github api requests diff --git a/github3/handlers/base.py b/github3/handlers/base.py index 68eb6b4..c27b80c 100644 --- a/github3/handlers/base.py +++ b/github3/handlers/base.py @@ -48,19 +48,20 @@ class Handler(object): assert response.status_code == 204 return True - #TODO: if limit is multiple of per_page... it do another request for nothing def _get_resources(self, resource, model=None, limit=None, **kwargs): """ Hander request to multiple resources """ + if limit: + limit = abs(limit) resource = self._prefix_resource(resource) counter = 1 for page in Paginate(resource, self._gh.get, **kwargs): for raw_resource in page: - if limit and counter > limit: break counter += 1 converter = self._get_converter(**kwargs) converter.inject(model) yield converter.loads(raw_resource) + if limit and counter > limit: break else: continue break |