github.py 858 B

123456789101112131415161718192021222324252627282930313233343536
  1. '''
  2. Module github.py contains a handful of methods
  3. for interacting with Github data.
  4. '''
  5. import requests
  6. import simplejson as json
  7. ########################
  8. # GITHUB API CONSTANTS #
  9. ########################
  10. API_BASE_URL = 'https://api.github.com/'
  11. API_USERS_URL = API_BASE_URL + 'users/DrkSephy'
  12. def getUserData():
  13. req = requests.get(API_USERS_URL)
  14. jsonList = []
  15. jsonList.append(json.loads(req.content))
  16. parsedData = []
  17. userData = {}
  18. for data in jsonList:
  19. userData['name'] = data['name']
  20. userData['blog'] = data['blog']
  21. userData['email'] = data['email']
  22. userData['public_gists'] = data['public_gists']
  23. userData['public_repos'] = data['public_repos']
  24. userData['avatar_url'] = data['avatar_url']
  25. userData['followers'] = data['followers']
  26. userData['following'] = data['following']
  27. parsedData.append(userData)
  28. return parsedData