In [10]:
import requests
gitlabReq = requests.get('https://api.github.com/user', auth=('mramanathan', 'Rus1729Sw#'))
gitlabReq.status_code
Out[10]:
200
In [5]:
gitlabReq.text
Out[5]:
u'{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}'
In [7]:
gitlabReq.json()
Out[7]:
{u'documentation_url': u'https://developer.github.com/v3',
u'message': u'Bad credentials'}
In [11]:
gitlabReq.text
Out[11]:
u'{"login":"mramanathan","id":4449217,"avatar_url":"https://avatars.githubusercontent.com/u/4449217?v=3","gravatar_id":"","url":"https://api.github.com/users/mramanathan","html_url":"https://github.com/mramanathan","followers_url":"https://api.github.com/users/mramanathan/followers","following_url":"https://api.github.com/users/mramanathan/following{/other_user}","gists_url":"https://api.github.com/users/mramanathan/gists{/gist_id}","starred_url":"https://api.github.com/users/mramanathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mramanathan/subscriptions","organizations_url":"https://api.github.com/users/mramanathan/orgs","repos_url":"https://api.github.com/users/mramanathan/repos","events_url":"https://api.github.com/users/mramanathan/events{/privacy}","received_events_url":"https://api.github.com/users/mramanathan/received_events","type":"User","site_admin":false,"name":"Ram","company":null,"blog":null,"location":"India","email":"rus.cahimb@gmail.com","hireable":true,"bio":null,"public_repos":6,"public_gists":0,"followers":0,"following":0,"created_at":"2013-05-16T15:58:34Z","updated_at":"2016-05-27T02:38:48Z","private_gists":0,"total_private_repos":0,"owned_private_repos":0,"disk_usage":325,"collaborators":0,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}}'
In [12]:
gitlabReq.json()
Out[12]:
{u'avatar_url': u'https://avatars.githubusercontent.com/u/4449217?v=3',
u'bio': None,
u'blog': None,
u'collaborators': 0,
u'company': None,
u'created_at': u'2013-05-16T15:58:34Z',
u'disk_usage': 325,
u'email': u'rus.cahimb@gmail.com',
u'events_url': u'https://api.github.com/users/mramanathan/events{/privacy}',
u'followers': 0,
u'followers_url': u'https://api.github.com/users/mramanathan/followers',
u'following': 0,
u'following_url': u'https://api.github.com/users/mramanathan/following{/other_user}',
u'gists_url': u'https://api.github.com/users/mramanathan/gists{/gist_id}',
u'gravatar_id': u'',
u'hireable': True,
u'html_url': u'https://github.com/mramanathan',
u'id': 4449217,
u'location': u'India',
u'login': u'mramanathan',
u'name': u'Ram',
u'organizations_url': u'https://api.github.com/users/mramanathan/orgs',
u'owned_private_repos': 0,
u'plan': {u'collaborators': 0,
u'name': u'free',
u'private_repos': 0,
u'space': 976562499},
u'private_gists': 0,
u'public_gists': 0,
u'public_repos': 6,
u'received_events_url': u'https://api.github.com/users/mramanathan/received_events',
u'repos_url': u'https://api.github.com/users/mramanathan/repos',
u'site_admin': False,
u'starred_url': u'https://api.github.com/users/mramanathan/starred{/owner}{/repo}',
u'subscriptions_url': u'https://api.github.com/users/mramanathan/subscriptions',
u'total_private_repos': 0,
u'type': u'User',
u'updated_at': u'2016-05-27T02:38:48Z',
u'url': u'https://api.github.com/users/mramanathan'}
Content source: mramanathan/pydiary_notes
Similar notebooks: