Skip to content

Python package that converts GraphQL query into dictionary.

License

Notifications You must be signed in to change notification settings

pgollangi/gql-query-utils

Repository files navigation

gql-query-utils

Python package with graphql queries utilities.

Install

Install with pip:

pip install gql-query-utils

Utilities

Convert graphql query string into dictionary

from gql_query_utils.utils import query_to_dict 

query_dict = query_to_dict("""
query GetThisStuff {
    viewer {
        personal(criteria: {
            name: "PETER",
            lastName: "SCHMIDT"
        }) {
            name
            address
        }
    }
}""")

print(query_dict)

Output:

{
  "query": {
    "viewer": {
      "personal": {
        "__args": {
          "criteria": {
            "name": "PETER",
            "lastName": "SCHMIDT"
          }
        },
        "name": true,
        "address": true
      }
    }
  }
}

Usage

from gql_query_utils.utils import query_to_dict 

query_to_dict(""" ${GQL_QUERY} """)

License

MIT

About

Python package that converts GraphQL query into dictionary.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages