aboutsummaryrefslogtreecommitdiffstats
path: root/github3/core.py
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2011-04-24 20:10:56 -0400
committerKenneth Reitz <me@kennethreitz.com>2011-04-24 20:10:56 -0400
commit37dbc386ad021ea2ed89ac66a6d23a4c7b207ba3 (patch)
tree0b3eeaf56abbf79a7a1a3f2f8acdff057bc7cbf9 /github3/core.py
parentGitHubModel (diff)
downloadpython-github3-37dbc386ad021ea2ed89ac66a6d23a4c7b207ba3.tar.xz
python-github3-37dbc386ad021ea2ed89ac66a6d23a4c7b207ba3.zip
logged in workaround.
Diffstat (limited to 'github3/core.py')
-rw-r--r--github3/core.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/github3/core.py b/github3/core.py
index 2f85040..95716a9 100644
--- a/github3/core.py
+++ b/github3/core.py
@@ -19,15 +19,18 @@ class GitHub(object):
rate_limit = None
rate_left = None
per_page = 30
+ accept = 'application/vnd.github.v3+json'
def __init__(self, apiurl=API_URL):
self.__basic_auth = None
def _get(self, *path):
- r = get(*path, auth=self.__basic_auth)
+ headers = {'Accept': self.accept}
- rate_limit = r.headers.get('x-ratelimit-remaining', None)
- rate_left = r.headers.get('x-ratelimit-limit', None)
+ r = get(*path, auth=self.__basic_auth, headers=headers)
+
+ rate_left = r.headers.get('x-ratelimit-remaining', None)
+ rate_limit = r.headers.get('x-ratelimit-limit', None)
if (rate_limit is not None) or (rate_left is not None):
self.rate_limit = rate_limit
@@ -48,7 +51,7 @@ class GitHub(object):
r = self._get('')
print
- if r.status_code == 200:
+ if r.status_code == 200 and self.__basic_auth:
return True
else:
return False