Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import os
import requests
import kinto_http
ACCESS_TOKEN = os.getenv("TOKEN", "")
SERVER = os.getenv("SERVER", "")
DICT_URL = os.getenv("SOURCE", "")
DOC_URL = ""
resp = requests.get(DICT_URL)
dictionaries = resp.json()
class OpenIDConnect(requests.auth.AuthBase):
def __call__(self, r):
r.headers["Authorization"] = "Bearer %s" % ACCESS_TOKEN
return r
client = kinto_http.Client(
if not ACCESS_TOKEN or "user" not in client.server_info():
raise ValueError("TOKEN env value '%s' is not a valid access token. See %s" % (ACCESS_TOKEN, DOC_URL))
with client.batch() as batch:
for lang, dictionaries in dictionaries.items():
batch.create_record(data=dict(id=lang, dictionaries=dictionaries))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.