aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2011-04-13 19:13:24 -0400
committerKenneth Reitz <me@kennethreitz.com>2011-04-13 19:13:24 -0400
commit4a173283eb55d7405bc56c75e47e94b2eb294795 (patch)
tree2888f33f8d7e27d88a6cca1da6a36e46b1f5c899
parentbasic models (diff)
downloadpython-github3-4a173283eb55d7405bc56c75e47e94b2eb294795.tar.xz
python-github3-4a173283eb55d7405bc56c75e47e94b2eb294795.zip
move api
-rw-r--r--github3/api.py (renamed from api.py)20
1 files changed, 11 insertions, 9 deletions
diff --git a/api.py b/github3/api.py
index 3d2bd78..c1f7687 100644
--- a/api.py
+++ b/github3/api.py
@@ -9,16 +9,19 @@
:license: ISC, see LICENSE for more details.
"""
-from convore.packages.anyjson import deserialize
+from . import models
+from .packages.anyjson import deserialize
import requests
-from . import models
API_URL = 'https://api.github.com'
-AUTH = None
+API_MIME = 'application/vnd.github.v3+json'
+
+
+
# =======
# Helpers
@@ -35,7 +38,7 @@ def _safe_response(r, error=None):
raise APIError(error) if error else APIError
-def get(*path, **kwargs):
+def get(*path, **params):
"""
Accepts optional error parameter, which will be passed in the event of a
non-401 HTTP error.
@@ -44,14 +47,13 @@ def get(*path, **kwargs):
api.get('groups', 'id')
api.get('accounts', 'verify')
"""
- url = '%s%s%s' % (API_URL, '/'.join(map(str, path)), '.json')
+ url = '{0}{1}'.format(API_URL, '/'.join(map(str, path)))
- params = kwargs.get('params', None)
+ # params = kwargs.get('params', None)
- r = requests.get(url, params=params, auth=auth)
+ r = requests.get(url, params=params, auth=None)
- error = kwargs.get('error', None)
- return _safe_response(r, error)
+ return _safe_response(r)
def post(params, *path):