0

This is what i'm sending over:

query = {"query": "mutation { memberCreate ( email:'[email protected]', fullName:'John Doe') { member { id username } } }"}

qb_request = requests.post("some_url",
                  headers={"Accept": "application/json",
                           "Authorization": "some_auth"
                           },
                           data=json.dumps(query))

And i get the following error:

{u'errors': [{u'message': u'No query string was present'}]}

What is the problem?

1 Answer 1

2

json.dumps transforms the json object into a String and in the headers you're accepting application/json. That's incompatible.

Try doing something like:

query = {"query": "mutation { memberCreate ( email:'[email protected]', fullName:'John Doe') { member { id username } } }"}

qb_request = requests.post("some_url",
                  headers={
                    "Accept": "application/json",
                    "Authorization": "some_auth"
                  },
                  data=query
              )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.