diff options
author | Mark Powers <mark@marks.kitchen> | 2021-09-27 22:02:49 -0500 |
---|---|---|
committer | Mark Powers <mark@marks.kitchen> | 2021-09-27 22:02:49 -0500 |
commit | 4e4b0997a2172e00c8a46acb6889fe2c8c939a09 (patch) | |
tree | 8ccc07bff1ae7f98a34d6f18d47b3595ebc4712b /custom_requests.py | |
parent | 4493e31a1afaf49187fc9a151982279d83b71f65 (diff) |
Add packaging tooling
Diffstat (limited to 'custom_requests.py')
-rw-r--r-- | custom_requests.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/custom_requests.py b/custom_requests.py deleted file mode 100644 index 65673cf..0000000 --- a/custom_requests.py +++ /dev/null @@ -1,30 +0,0 @@ -import requests -import sys -import json -from config import config - -def handle_errors(r): - error = False - if r.status_code != 200: - error = True - print("Error status code: %s" % r.status_code) - json = r.json() - if "errors" in json: - error = True - for e in json["errors"]: - print(e["message"]) - print(e) - if error: - sys.exit(1) - - -def get_headers(): - return { "Authorization": "Bearer %s" % config["wiki"]["key"] } - -def send_query(query, query_vars): - '''Returns status code, json''' - payload = { "query": query, "variables": query_vars} - r = requests.post(config["wiki"]["url"], json=payload, headers = get_headers()) - handle_errors(r) - return r.json() - |