Skip to content

Instantly share code, notes, and snippets.

@mattandrews
Created July 9, 2014 10:45
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 mattandrews/e9e54e792cad9fe8589e to your computer and use it in GitHub Desktop.
Save mattandrews/e9e54e792cad9fe8589e to your computer and use it in GitHub Desktop.
Guardian Content API python example
import requests
def get_content():
api_url = 'http://content.guardianapis.com/'
payload = {
'api-key': 'YOUR-API-KEY-HERE',
'page-size': 10,
'show-editors-picks': 'true',
'show-elements': 'image',
'show-fields': 'all'
}
response = requests.get(api_url, params=payload)
data = response.json() # convert json to python-readable format
return data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment