Unexpected End of Document in GraphQL post (taken from example)

I found a post that describes this error with python requests.

The trick is you have to change the ‘Content-Type’ header to ‘application/json’.

Then I had to change the post string to:

r = requests.post(url,json={"query": query, "variables": params},  headers=headers)

https://github.com/Shopify/graphql-js-client/issues/132

This is how you post to GraphQL using Python request. This may be very helpful to other people.

2 Likes