Post request with GraphQL Payload in python3

karen foo
1 reply
Hello I'm trying to make a Post request to ProductHunt API. In the example they provide the following payload: { "query": "query { posts(first: 1) { edges { node { id, name } } } }" } This is my Python implementation: queryz = { 'query' : '{ posts(first: 1) { edges { node { id, name } } } }' } r =, headers=headerz, data=queryz) r.text I tried encoding the payload in Json but I always get the same response When I do the request I always get a 400 Bad Request response, I tried the same request in Postman using GraphQL query and I get the correct response. What am I doing wrong?


Naruto Asao
The creator's dedication to the language is palpable as they endeavor to share not only their triumphs but also the example fastapi pagination obstacles they've encountered and surmounted along the way.