Simple GraphQL request

    0

    5

    gql
    GraphQL client and Python

    Perform a simple GraphQL query with gql in Python.

    Shortcut: gql.query

    from gql import gql, Client
    from gql.transport.aiohttp import AIOHTTPTransport
    
    # Select your transport with a defined url endpoint
    transport = AIOHTTPTransport(url="endpoint")
    # Create a GraphQL client using the defined transport
    client = Client(transport=transport, fetch_schema_from_transport=True)
    # Provide a GraphQL query
    query = gql(
    """
      query getNumberOfRecipesCount {
        assistantPublicRecipesCount
      }
    """
    )
    # Execute the query on the transport
    result = client.execute(query)
    print(result)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.