Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pgollangi/gql-query-utils
Python package that converts GraphQL query into dictionary.
https://github.com/pgollangi/gql-query-utils
graphql graphql-queries graphql-query python3
Last synced: about 1 month ago
JSON representation
Python package that converts GraphQL query into dictionary.
- Host: GitHub
- URL: https://github.com/pgollangi/gql-query-utils
- Owner: pgollangi
- License: mit
- Created: 2022-11-17T10:17:37.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-06T14:39:45.000Z (about 1 year ago)
- Last Synced: 2024-10-30T19:07:04.992Z (about 2 months ago)
- Topics: graphql, graphql-queries, graphql-query, python3
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gql-query-utils
Python package with graphql queries utilities.## Install
Install with `pip`:
```commandline
pip install gql-query-utils
```## Utilities
### Convert graphql query string into dictionary
```python
from gql_query_utils.utils import query_to_dictquery_dict = query_to_dict("""
query GetThisStuff {
viewer {
personal(criteria: {
name: "PETER",
lastName: "SCHMIDT"
}) {
name
address
}
}
}""")print(query_dict)
```
Output:
```json
{
"query": {
"viewer": {
"personal": {
"__args": {
"criteria": {
"name": "PETER",
"lastName": "SCHMIDT"
}
},
"name": true,
"address": true
}
}
}
}
```## Usage
```python
from gql_query_utils.utils import query_to_dictquery_to_dict(""" ${GQL_QUERY} """)
```
## License
[MIT](./LICENSE)