Skip to main content

A Python library for making GraphQL requests easier!

Project description

gqlrequests - A Python library for making GraphQL requests easier!

Define GraphQL types in Python, then use them to build queries super easy:

from gqlrequests import GraphQLType
from gqlrequests.primitives import *

# All the primitive types available
# from gqlrequests.primitives import ID
# from gqlrequests.primitives import Int
# from gqlrequests.primitives import Float
# from gqlrequests.primitives import String
# from gqlrequests.primitives import Boolean


class Episode(GraphQLType):
    name = String
    length = Float

class Character(GraphQLType):
    name = String
    appearsIn = [Episode]

print(Character())
# type Character {
#     appearsIn: [Episode]
#     name: String
# }
#

print(Character.query())
# {
#     appearsIn {
#         name
#         length
#     }
#     name
# } 

print(Character.query("name"))
# {
#     name
# } 

print(Character.query(indent=2)) # Default indent is 4
# {
#   appearsIn {
#     name
#     length
#   }
#   name
# } 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gqlrequests-0.0.2.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

gqlrequests-0.0.2-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page