Python requests module provides very interactive way to access web content via
proper HTTP protocol.
Installation:
Here is the installation manual. You can also install using pip :
pip install requests
Here is the installation manual. You can also install using pip :
pip install requests
import requests r = requests.get('https://api.github.com/user', auth=('user', 'pass')) print r.status_code print r.headers['content-type'] print r.encoding print r.text print r.json()
Output:
200 'application/json; charset=utf8' 'utf-8' u'{"type":"User"...' {u'private_gists': 419, u'total_private_repos': 77, ...}
0 comments:
Post a Comment