Post request with GraphQL Payload in python3

karen foo
0 replies
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 = requests.post(url, headers=headerz, data=queryz) r.text https://www.quickpayportal.io/ 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. https://www.quickpayportal.pro/ What am I doing wrong?
🤔
No comments yet