diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-09-25 20:28:58 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-09-25 20:28:58 -0500 |
commit | b1d66f527869236b877207fb617c2660ef68e95e (patch) | |
tree | 34cb6060e0da49f51fbc95449c54d37d948c94f7 /graphql_requests.py | |
parent | 9275df710e578aa0ce67de12a952d76e3f036757 (diff) |
Add edit page command
Diffstat (limited to 'graphql_requests.py')
-rw-r--r-- | graphql_requests.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/graphql_requests.py b/graphql_requests.py deleted file mode 100644 index f802cdd..0000000 --- a/graphql_requests.py +++ /dev/null @@ -1,31 +0,0 @@ -import requests -import sys -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"]) - if error: - sys.exit(1) - - -def get_headers(): - return { "Authorization": "Bearer %s" % config["wiki"]["key"] } - -def escape_query(query): - return query.replace('"', '\"') - -def send_query(query): - '''Returns status code, json''' - payload = { "query": query } - r = requests.post(config["wiki"]["url"], json=payload, headers = get_headers()) - handle_errors(r) - return r.json() - |