Permalink
Browse files

Add auth to request for user repos

  • Loading branch information...
1 parent 737ea44 commit c93844858fdfbf463b0632629782a163d63c5b92 @tclem committed Oct 29, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 github.py
View
@@ -18,19 +18,21 @@ def user(self):
response = requests.get('https://api.github.com/users/%s' % self.username)
content = response.content
data = json.loads(content)
- user = User(data)
+ user = User(data, self)
return user
class User(object):
_keys = ['name', 'email']
- def __init__(self, data):
+ def __init__(self, data, gh):
+ self.gh = gh
for key in self._keys:
setattr(self, key, data[key])
@property
def repos(self):
response = requests.get(
- 'https://api.github.com/user/repos')
+ 'https://api.github.com/user/repos',
+ auth=(self.gh.username, self.gh.password))
content = response.content
data = json.loads(content)
return data

0 comments on commit c938448

Please sign in to comment.