# Bitquery GraphQL API Python Package (bitquery-python)

**URL:** <https://community.bitquery.io/t/bitquery-graphql-api-python-package-bitquery-python/948>\
**Category:** GraphQL Tutorials\
**Tags:** api, python\
**Created:** [March 31, 2022, 1:27pm UTC](https://community.bitquery.io/t/bitquery-graphql-api-python-package-bitquery-python/948 "2022-03-31T13:27:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alb2001](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@alb2001](https://community.bitquery.io/u/alb2001)\
**Post date:** [March 31, 2022, 1:27pm UTC](https://community.bitquery.io/t/bitquery-graphql-api-python-package-bitquery-python/948/1 "2022-03-31T13:27:34Z")

</div>

# bitquery-python

A simple package to query GraphQL using Bitquery

## Installation

```auto
pip install bitquery-python

```

## Obtaining API Key

You will need to create an account on the GraphQL IDE to be able to obtain an API key.

## Running queries

Here is an example code to run a query

```auto
from bitquery import bitquery

API_KEY = "YOUR API KEY"

query = """
query{
  bitcoin{
    blocks{
      count
    }
   }
}
"""

result = bitquery.run_query(API_KEY, query)
print(result)

```

## Links:

- [GitHub - alb2001/bitquery-python: A simple package to query GraphQL using Bitquery](https://github.com/alb2001/bitquery-python)
- [Client Challenge](https://pypi.org/project/bitquery-python)
