Questions tagged [graphql-python]

For questions about python implementations of GraphQL query language. If an specific library is used, add that tag to the question too.

GraphQL is a query language for APIs created by Facebook. It's specification is currently public and can be checked here.

There are well known implementations for servers to support this query language, allowing them to build the typed schema or serve queries against that schema. Some of them are:

Use this tag to make questions about any of these, to ask something of one library compared to the other, to get best practices for implementing these, or others.

29 questions
1
vote
1 answer

Accessing node's full path in graphene middleware

I am trying to add some logging to my graphene server utilizing a middleware. As per the documentation (Docs - 3.2.3), I can view some limited path info from the parent by pulling out the name from the root's meta node (root._meta.name which will…
1
vote
0 answers

How import GraphQLLocatedError and except it

i want to import GraphQLLocatedError and except it like this. from graphql.error.located_error import GraphQLLocatedError try: try code except GraphQLLocatedError: except code but it doesn't work.. please help me.
1
vote
1 answer

Union type cannot resolve Object Type at Runtime

I am setting up a GraphQL Server with Python using Starlette and Graphene and ran into a problem I cannot find a solution for. The Graphene Documentation does not go into detail regarding the union type, which I am trying to implement. I set up a…
jmandt
  • 386
  • 5
  • 13
1
vote
1 answer

How change the Connection Arguments (after, before) in graphene-python (relay)?

Using: Django 3.x [ Django-Filters 2.2.0, graphene-django 2.8.0, graphql-relay 2.0.1 ] Vue 2.x [ Vue-Apollo ] After applying some filters (iContains etc.) on my graphQL search i tried to change or manipulate the connection_args like firstor…
1
vote
1 answer

"Must provide query string." graphene-python

i try to send a file as following in Altair tool to graphql (backend is graphene-python). I use this library for backend but every it raises this error: Must provide query string. how can I upload a file to graphql?
msln
  • 1,318
  • 2
  • 19
  • 38
1
vote
1 answer

GraphQLError Unknown type "XYZMutationInput"

How to create graphql input type for DRF serializer? I am using django rest framework (DRF) serializers, graphene-django, and I am able to see the CreateThingMutationInput type defined in graphiql: mutation TestCreate($input:…
jmunsch
  • 22,771
  • 11
  • 93
  • 114
0
votes
1 answer

Graphql multiple queries and mutation using Graphene

I chose to handle sending multiple Queries and Mutations as follow, First I defined a Schema defined in schema.py: # schema.py code from graphene import Schema, Field, ObjectType from .basic_objects.queries import BasicQuery from…
0
votes
1 answer

How might I pass a list as a variable in a python gql query?

Based on the example from the gql documentation, I have the below, working query: from gql import gql, Client from gql.transport.aiohttp import AIOHTTPTransport # Select your transport with a defined url endpoint transport =…
jhschwartz
  • 168
  • 1
  • 2
  • 13
0
votes
0 answers

Extract header from GraphQL response, over websocket transport

I have a client and server that communicate with GraphQL over websocket transport. Everything is written in python: On the client side I use the gql package, and on the server side I use the strawberry packge. I want to add a custom header for the…
0
votes
0 answers

GraphQL file uploads and cURL: json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 188 (char 187)

I have a graphql-server that is running at localhost:3001 I want to send files to a python flask server together with some variables in a cURL request. Here is what i'm sending curl http://localhost:3001/graphql/ -F operations='{ "query": "mutation…
crispengari
  • 7,901
  • 7
  • 45
  • 53
0
votes
1 answer

Graphene Python mutation list input

I have a mutation that looks like this class ApisInteractiveGlobal(BaseMutation): success = Boolean() error = String() class Arguments: user_id = List(ID) api_name = String() global_apis = Boolean() my_org_api = Boolean() def…
Naga Satya
  • 23
  • 3
0
votes
1 answer

How to detect GraphQL endpoint using Python

I am trying to detect a graphql endpoint using Python language. I am an absolute beginner , but i have tried to make a code. Can you please suggest changes and better ways to do it? CODE: import requests,urllib,urllib.request import…
0
votes
1 answer

AssertionError: The type Droid does not match with the associated graphene type Droid

I am trying to understand the working of interfaces using the starwars example given in the github repository code. The execution of a simple query leads to an AssertionError query = """query HeroNameQuery { hero { name } }""" AssertionError: The…
Saurabh
  • 111
  • 1
  • 7
-1
votes
1 answer

Query multiple models in Graphene Django

I have multiple models in Django named model1, model2, model3. Each model has the same fields and the field id is the primary key. I want to query this database using GraphQL. The query structure should be like below. query{ pod(model:…
1
2