A simple package to query GraphQL using Bitquery
pip install bitquery-python
You will need to create an account on the GraphQL IDE to be able to obtain an API key.
Here is an example code to run a query
from bitquery import bitquery
API_KEY = "YOUR API KEY"
query = """
query{
bitcoin{
blocks{
count
}
}
}
"""
result = bitquery.run_query(API_KEY, query)
print(result)