Skip to content

Instantly share code, notes, and snippets.

@drawcode
Created December 5, 2012 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawcode/4211303 to your computer and use it in GitHub Desktop.
Save drawcode/4211303 to your computer and use it in GitHub Desktop.
Python requests request
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
r = requests.get('https://api.github.com', auth=('user', 'pass'))
print r.status_code
print r.headers['content-type']
# ------
# 200
# 'application/json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment