0

Here is a graphql query with its result : OK.

I try to get the same result with Python, but I get nothing : response.text is empty. (API key is not needed).

q = """
{
  node(id: "UXVlc3Rpb25uYWlyZTo5NTNjYjdjYS0xY2E0LTExZTktOTRkMi1mYTE2M2VlYjExZTE=") {
    ... on Questionnaire {
      replies(first: 10, after: null) {
        totalCount
        pageInfo {
          hasNextPage
          endCursor
        }
        edges {
          node {
            id
            createdAt
            publishedAt
            updatedAt
            author {
              id
            }
            responses {
              question {
                title
              }
              ... on ValueResponse {
                value
              }
            }
          }
        }
      }
    }
  }
}
"""

response = requests.post(url = "https://granddebat.fr/graphql" , json = {'query': q})

print(response.text)

Please, any idea ?

1 Answer 1

1

It's all good with the query itself. In request you need to pass headers with {'Accept': 'application/vnd.cap-collectif.preview+json'}

response = requests.post(
    url = "https://granddebat.fr/graphql",
    json = {'query': q,},
    headers= {'Accept': 'application/vnd.cap-collectif.preview+json'}
)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you !! It's OK with headers !

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.