Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (22 sloc) 0.698 kb
4c036aa @Singletoned Added very basic first test
Singletoned authored
1 # -*- coding: utf-8 -*-
2
3 import json
4
5 import requests
6
7
8 class Github(object):
9 def __init__(self, username, password):
10 self.username = username
11 self.password = password
12 response = requests.get(
13 'https://api.github.com/',
14 auth=(self.username, self.password))
15
16 @property
17 def user(self):
18 response = requests.get('https://api.github.com/users/%s' % self.username)
19 content = response.content
fed0810 @Singletoned Added a basic User object
Singletoned authored
20 data = json.loads(content)
21 user = User(data)
22 return user
23
24 class User(object):
25 _keys = ['name', 'email']
26
27 def __init__(self, data):
28 for key in self._keys:
29 setattr(self, key, data[key])
Something went wrong with that request. Please try again.