Skip to content

Instantly share code, notes, and snippets.

@heycarsten
Created May 25, 2017 20:38
Show Gist options
  • Save heycarsten/8e5ff89f4b827dfb125452001aa8b4b7 to your computer and use it in GitHub Desktop.
Save heycarsten/8e5ff89f4b827dfb125452001aa8b4b7 to your computer and use it in GitHub Desktop.
# Python 3.6.1
from urllib.request import urlopen, Request
import json
url = 'http://lcboapi.com/products?q=gose'
req = Request(url)
req.add_header(
'Authorization', 'Token token="YOUR_API_KEY_HERE"'
)
res = urlopen(req).read().decode('utf8')
data = json.loads(res)
print(data['result'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment