Skip to content

Instantly share code, notes, and snippets.

@alayek
Created May 26, 2016 10:42
Show Gist options
  • Save alayek/90d77495291812539835b3cfe037ac47 to your computer and use it in GitHub Desktop.
Save alayek/90d77495291812539835b3cfe037ac47 to your computer and use it in GitHub Desktop.
Python install requests and import it
try:
import requests
except ImportError:
import pip
pip.main(['install', 'requests']) # if not running in venv, pass the --users flag too
import requests
r = requests.get('https://api.github.com/events')
print(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment