mirror of
https://github.com/kennethreitz/python-github3.git
synced 2026-06-05 23:10:17 +00:00
/s/heroku/github
This commit is contained in:
+6
-7
@@ -1,10 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
heroku.api
|
github3.api
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
This module provides the basic API interface for Heroku.
|
This module provides the basic API interface for Github.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -18,7 +18,7 @@ GITHUB_URL = 'https://api.github.com'
|
|||||||
|
|
||||||
|
|
||||||
class GithubCore(object):
|
class GithubCore(object):
|
||||||
"""The core Heroku class."""
|
"""The core Github class."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(GithubCore, self).__init__()
|
super(GithubCore, self).__init__()
|
||||||
|
|
||||||
@@ -32,10 +32,10 @@ class GithubCore(object):
|
|||||||
self._s.headers.update({'Accept': 'application/json'})
|
self._s.headers.update({'Accept': 'application/json'})
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<heroku-core at 0x%x>' % (id(self))
|
return '<github-core at 0x%x>' % (id(self))
|
||||||
|
|
||||||
def login(self, username, password):
|
def login(self, username, password):
|
||||||
"""Logs user into Heroku with given api_key."""
|
"""Logs user into Github with given credentials."""
|
||||||
|
|
||||||
# Attach auth to session.
|
# Attach auth to session.
|
||||||
self._s.auth = (username.password)
|
self._s.auth = (username.password)
|
||||||
@@ -51,7 +51,7 @@ class GithubCore(object):
|
|||||||
|
|
||||||
def _url_for(self, *args):
|
def _url_for(self, *args):
|
||||||
args = map(str, args)
|
args = map(str, args)
|
||||||
return '/'.join([self._heroku_url] + list(args))
|
return '/'.join([self._github_url] + list(args))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _resource_serialize(o):
|
def _resource_serialize(o):
|
||||||
@@ -76,7 +76,6 @@ class GithubCore(object):
|
|||||||
url = self._url_for(*resource)
|
url = self._url_for(*resource)
|
||||||
r = self._s.request(method, url, params=params, data=data)
|
r = self._s.request(method, url, params=params, data=data)
|
||||||
|
|
||||||
# TODO: check heroku's status codes
|
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|||||||
Reference in New Issue
Block a user