# GraphQL Loader
```bash
pip install llama-index-readers-graphql
```
This loader loads documents via GraphQL queries from a GraphQL endpoint.
The user specifies a GraphQL endpoint URL with optional credentials to initialize the reader.
By declaring the GraphQL query and optional variables (parameters) the loader can fetch the nested result docs.
## Usage
Here's an example usage of the GraphQLReader.
You can test out queries directly [on the site](https://countries.trevorblades.com/)
```python
import os
from llama_index.readers.graphql import GraphQLReader
uri = "https://countries.trevorblades.com/"
headers = {}
query = """
query getContinents {
continents {
code
name
}
}
"""
reader = GraphQLReader(uri, headers)
documents = reader.query(query, variables={})
```
This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index)
and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
It uses the [gql GraphQL library](https://pypi.org/project/gql/) for the GraphQL queries.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-graphql",
"maintainer": "jexp",
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": "apollo, gql, graphql",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/a4/9a/f8669716cd3bf6383f9072b26eaabf7d324540f36180271813c5a5d53e9c/llama_index_readers_graphql-0.2.0.tar.gz",
"platform": null,
"description": "# GraphQL Loader\n\n```bash\npip install llama-index-readers-graphql\n```\n\nThis loader loads documents via GraphQL queries from a GraphQL endpoint.\nThe user specifies a GraphQL endpoint URL with optional credentials to initialize the reader.\nBy declaring the GraphQL query and optional variables (parameters) the loader can fetch the nested result docs.\n\n## Usage\n\nHere's an example usage of the GraphQLReader.\nYou can test out queries directly [on the site](https://countries.trevorblades.com/)\n\n```python\nimport os\n\nfrom llama_index.readers.graphql import GraphQLReader\n\nuri = \"https://countries.trevorblades.com/\"\nheaders = {}\nquery = \"\"\"\n query getContinents {\n continents {\n code\n name\n }\n }\n\"\"\"\nreader = GraphQLReader(uri, headers)\ndocuments = reader.query(query, variables={})\n```\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index)\nand/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.\n\nIt uses the [gql GraphQL library](https://pypi.org/project/gql/) for the GraphQL queries.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers graphql integration",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"apollo",
" gql",
" graphql"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d981dbb4f334c79a9bfce4bfd4d7e83597397d7d8209ef65ade3b0834fab38c9",
"md5": "8717f2ab840cc418622cc36c4dd06f86",
"sha256": "80dee4bd96592c93d15ec49243bbe176e6c601a538eadaa6bd15f1c5be6155b8"
},
"downloads": -1,
"filename": "llama_index_readers_graphql-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8717f2ab840cc418622cc36c4dd06f86",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 2922,
"upload_time": "2024-08-22T06:14:21",
"upload_time_iso_8601": "2024-08-22T06:14:21.835009Z",
"url": "https://files.pythonhosted.org/packages/d9/81/dbb4f334c79a9bfce4bfd4d7e83597397d7d8209ef65ade3b0834fab38c9/llama_index_readers_graphql-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a49af8669716cd3bf6383f9072b26eaabf7d324540f36180271813c5a5d53e9c",
"md5": "b2471b1a5a65d4c9a5e0bb82a83c7df0",
"sha256": "0c93fafc3c49b6fa871b9e92606a9aec94faccc1b4b1fa98a178ae7b57493bc2"
},
"downloads": -1,
"filename": "llama_index_readers_graphql-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "b2471b1a5a65d4c9a5e0bb82a83c7df0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 2711,
"upload_time": "2024-08-22T06:14:23",
"upload_time_iso_8601": "2024-08-22T06:14:23.186627Z",
"url": "https://files.pythonhosted.org/packages/a4/9a/f8669716cd3bf6383f9072b26eaabf7d324540f36180271813c5a5d53e9c/llama_index_readers_graphql-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 06:14:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-graphql"
}