Skip to content

Instantly share code, notes, and snippets.

@sandes
Created January 16, 2015 14:40
Show Gist options
  • Save sandes/6fce0a27c3456ef2dce4 to your computer and use it in GitHub Desktop.
Save sandes/6fce0a27c3456ef2dce4 to your computer and use it in GitHub Desktop.
Get access token instagram
import pycurl,urllib
try:
# python 3
from urllib.parse import urlencode
except ImportError:
# python 2
from urllib import urlencode
curl = pycurl.Curl()
curl.setopt(pycurl.URL,"https://api.instagram.com/oauth/access_token")
post_data = { 'client_id': '',
'client_secret': '',
'redirect_uri': '',
'code': '',
'grant_type': 'authorization_code'
}
post_fields = urllib.urlencode(post_data)
curl.setopt(pycurl.POST, True)
curl.setopt(pycurl.POSTFIELDS, post_fields)
curl.perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment