Created
August 6, 2013 09:54
-
-
Save andreagrandi/6163253 to your computer and use it in GitHub Desktop.
This is an example of an API call (a GET method) using the requests Python library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from urllib import urlencode | |
api_base_url = 'http://localhost:8001/api/1/' | |
api_token = '******************************************' | |
auth_header = {'Authorization': 'Token ' + api_token} | |
parameters = [('type', 'adcountry'), ('limit', 1000)] | |
request = requests.get(api_base_url + 'facebook/search/', params = urlencode(parameters), headers = auth_header) | |
print request.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment