Beginning to work with api version2…
adjusted a code snippet from the old documentation to python3 and api2 but it doesn’t work, I hit a 403 wall
What’s wrong?
import urllib.request
import json
API_KEY = …
url = ‘https://www.lingq.com/api/v2/languages/’
headers={‘Authorization’: 'Token ’ + API_KEY}
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req) as response:
lang_json = response.read()
languages = json.loads(lang_json)
for language in languages:
print (language)