aboutsummaryrefslogtreecommitdiffstats
path: root/github3/api.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2011-10-29 16:11:27 +0200
committerDavid Medina <davidmedina9@gmail.com>2011-10-31 00:34:31 +0100
commitc23698e64f3244636290ffa4065f3b70ba5151e9 (patch)
tree37fee2463eb1aedbf758fe1b9b9afd173c5908c8 /github3/api.py
parentUpdate requests (fixs with auth) (diff)
downloadpython-github3-c23698e64f3244636290ffa4065f3b70ba5151e9.tar.xz
python-github3-c23698e64f3244636290ffa4065f3b70ba5151e9.zip
Wip on handlers
Diffstat (limited to 'github3/api.py')
-rw-r--r--github3/api.py28
1 files changed, 8 insertions, 20 deletions
diff --git a/github3/api.py b/github3/api.py
index 81ae3e7..7b63b2d 100644
--- a/github3/api.py
+++ b/github3/api.py
@@ -18,8 +18,7 @@ from .packages.link_header import parse_link_value
from .models import *
from .helpers import is_collection, to_python, to_api, get_scope
from .config import settings
-
-
+import handlers
PAGING_SIZE = 100
@@ -199,24 +198,13 @@ class Github(GithubCore):
super(Github, self).__init__()
self.is_authenticated = False
-
- def get_user(self, username):
- """Get a single user."""
- return self._get_resource(('users', username), User)
-
-
- def get_me(self):
- """Get the authenticated user."""
- return self._get_resource(('user'), CurrentUser)
-
- def get_repo(self, username, reponame):
- """Get the given repo."""
- return self._get_resource(('repos', username, reponame), Repo)
-
- def get_org(self, login):
- """Get organization."""
- return self._get_resource(('orgs', login), Org)
-
+ def user_handler(self, username=None):
+ if not getattr(self, '_user_handler'):
+ if self.is_authenticated:
+ self._user_handler = handlers.AuthUser(self)
+ else:
+ self._user_handler = handlers.User(self, username)
+ return self._user_handler
class ResponseError(Exception):
"""The API Response was unexpected."""