question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitHub API: Server did not return a GraphQL result

See original GitHub issue

Hello,

I want to get some information from Github API. I using your gql. When I do simple request I got “Server did not return a GraphQL result”. Do you have any idea what I doing wrong?

from gql import gql, Client, AIOHTTPTransport

URL = "https://api.github.com/graphql"

transport = AIOHTTPTransport(url=URL, headers={'Authorization': 'MY_TOKEN'})

client = Client(transport=transport, fetch_schema_from_transport=True)

query = gql('''
query {
  search(query: "test", type: ISSUE, first: 20) {
    nodes {
      ... on Issue {
        id
        bodyHTML
        title
        url
        closed
      }
    }
  }
}
''')

result = client.execute(query)
print(result)

venv/lib/python3.8/site-packages/gql/transport/aiohttp.py", line 161, in execute raise TransportProtocolError(“Server did not return a GraphQL result”) gql.transport.exceptions.TransportProtocolError: Server did not return a GraphQL result

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
leszekhanuszcommented, Oct 12, 2020

Note: I created a token to test this and now this works for me with your code.

The only modification I made is to add “bearer” before the token:

transport = AIOHTTPTransport(url=URL, headers={'Authorization': 'bearer MY_TOKEN'})

1reaction
leszekhanuszcommented, Oct 24, 2020

With PR #155 the message should be more clear:

    raise TransportProtocolError(
gql.transport.exceptions.TransportProtocolError: Server did not return a GraphQL result: No "data" or "error" keys in answer: {"message":"This endpoint requires you to be authenticated.","documentation_url":"https://docs.github.com/v3/#authentication"}
Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL query does not return result · Discussion #128 - GitHub
My localhost server returns the response 200. When I use Query Inspector to discover the query, it still keeps loading. Therefore, it returns...
Read more >
Forming calls with GraphQL - GitHub Docs
GraphQL queries return only the data you specify. To form a query, you must specify fields within fields (also known as nested subfields)...
Read more >
Can I do any action just after return my response with an API ...
Summary I am trying to perform an action right after returning my response to a GraphQL API request. Let me explain: I would...
Read more >
GraphQL API - GitHub Docs
GraphQL API. To create integrations, retrieve data, and automate your workflows, use the GitHub GraphQL API. The GitHub GraphQL API offers more precise...
Read more >
Queries returning only errors are forced to be a 500 · Issue #427
On commit b3ccce9 a query response containing only the errors field is forced to be a 500, however these errors could easily be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found