Skip to content

Instantly share code, notes, and snippets.

@K-7
Forked from Echocage/auth.py
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save K-7/17739882bafe28ad2541 to your computer and use it in GitHub Desktop.

Select an option

Save K-7/17739882bafe28ad2541 to your computer and use it in GitHub Desktop.
>>> from requests.auth import HTTPBasicAuth
>>> auth = HTTPBasicAuth('fake@example.com', 'not_a_real_password')
>>> r = requests.post(url=url, data=body, auth=auth)
>>> r.status_code
201
>>> content = r.json()
>>> print(content[u'body'])
Sounds great! I'll get right on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment