Created
November 2, 2012 00:02
-
-
Save mekarpeles/3997726 to your computer and use it in GitHub Desktop.
A demonstration of using the Github API to access public user data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
import requests | |
def user(username): | |
""" | |
>>> print(user('mekarpeles')) | |
{u'public_repos': 23, u'public_gists': 2, u'name': u'Michael E. Karpeles', u'created_at': u'2011-08-13T20:01:14Z', u'url': u'https://api.github.com/users/mekarpeles'\ | |
, u'company': u'Hyperink', u'html_url': u'https://github.com/mekarpeles', u'id': 978325, u'blog': None, u'hireable': True, u'avatar_url': u'https://secure.gravatar.com/a\ | |
vatar/7ca82283af0b65b163dde4f5f5e3fb41?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png', u'followers': 22, u'location': u'San \ | |
Francisco', u'bio': None, u'gravatar_id': u'7ca82283af0b65b163dde4f5f5e3fb41', u'following': 19, u'login': u'mekarpeles', u'type': u'User', u'email': u'michael.karpeles@\ | |
gmail.com'} | |
""" | |
x = requests.get('https://api.github.com/users/{}'.format(username)) | |
return x.json | |
if __name__ == "__main__": | |
print(user('mekarpeles')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment