Skip to content

Instantly share code, notes, and snippets.

@sayon-bitquery
Last active June 10, 2021 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayon-bitquery/7094a096d5390377489d7497f2415c60 to your computer and use it in GitHub Desktop.
Save sayon-bitquery/7094a096d5390377489d7497f2415c60 to your computer and use it in GitHub Desktop.
Function to integrate Bitquery's GraphQL API
def run_query(query):
headers = {'X-API-KEY': YOUR API KEY}
request = requests.post('https://graphql.bitquery.io/', json={'query': query}, headers=headers)
if request.status_code == 200:
return request.json()
else:
raise Exception('Query failed and return code is {}. {}'.format(request.status_code, query))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment