#!/usr/bin/env python import requests, os, json, sys from src.utils.jsonLogger import log class keys(): def __init__(self): self.uri = os.getenv("DATABASE_URL") def send(query): try: uri = keys().uri + "/graphql" headers = {'Content-type': 'application/json'} response = requests.post(uri, json={'query': query}, headers=headers) statusCode = response.status_code response = json.loads(response.text) return statusCode, response except requests.exceptions.HTTPError as e: log("Unable to send data down to db-gateway: {}".format(e), 'ERR') sys.exit(1) except requests.exceptions.RequestException as e: log("Unable to send data down to db-gateway: {}".format(e), 'ERR') sys.exit(1)