python requests with login

Solutions on MaxInterview for python requests with login by the best coders in the world

showing results for - "python requests with login"
Carley
23 Jan 2020
1>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
2>>> r.status_code
3200
4>>> r.headers['content-type']
5'application/json; charset=utf8'
6>>> r.encoding
7'utf-8'
8>>> r.text
9'{"type":"User"...'
10>>> r.json()
11{'private_gists': 419, 'total_private_repos': 77, ...}
12