aboutsummaryrefslogtreecommitdiffstats
path: root/github3/api.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2011-11-01 12:30:25 +0100
committerDavid Medina <davidmedina9@gmail.com>2011-11-01 12:30:25 +0100
commitb17dbea56f59aa5403e5722e12878c7183742551 (patch)
treeea02535e78ae2c59d9099850e5ab2d4b1d044f10 /github3/api.py
parentWip on handlers (diff)
downloadpython-github3-b17dbea56f59aa5403e5722e12878c7183742551.tar.xz
python-github3-b17dbea56f59aa5403e5722e12878c7183742551.zip
Decouple Handlers and Models
Handler User complete
Diffstat (limited to 'github3/api.py')
-rw-r--r--github3/api.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/github3/api.py b/github3/api.py
index 7b63b2d..d99682a 100644
--- a/github3/api.py
+++ b/github3/api.py
@@ -15,7 +15,6 @@ from decorator import decorator
from .packages import omnijson as json
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
@@ -170,6 +169,9 @@ class GithubCore(object):
page += 1
+ def _get_bool(self, resource):
+ resp = self._http_resource('GET', resource, check_status=False)
+ return True if resp.status_code == 204 else False
def _to_map(self, obj, iterable):
"""Maps given dict iterable to a given Resource object."""
@@ -181,16 +183,6 @@ class GithubCore(object):
return a
- def _get_url(self, resource):
-
- if is_collection(resource):
- resource = map(str, resource)
- resource = '/'.join(resource)
-
- return resource
-
-
-
class Github(GithubCore):
"""docstring for Github"""
@@ -198,8 +190,8 @@ class Github(GithubCore):
super(Github, self).__init__()
self.is_authenticated = False
- def user_handler(self, username=None):
- if not getattr(self, '_user_handler'):
+ def user_handler(self, username=None, force=False):
+ if force or not getattr(self, '_user_handler', False):
if self.is_authenticated:
self._user_handler = handlers.AuthUser(self)
else: