Skip to content

Instantly share code, notes, and snippets.

@bertrandmartel
Created March 31, 2021 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertrandmartel/34a3db0a8f223a9d14f07ddaa0329d49 to your computer and use it in GitHub Desktop.
Save bertrandmartel/34a3db0a8f223a9d14f07ddaa0329d49 to your computer and use it in GitHub Desktop.
Github Graphql API cursor decoding
import requests
import base64
token = "YOUR_TOKEN"
query = """
query {
search(type:ISSUE, query:"repo:mui-org/material-ui is:issue", first: 100){
nodes {
... on Issue {
number
title
}
}
pageInfo {
endCursor
}
}
}
"""
r = requests.post("https://api.github.com/graphql",
headers={
"Authorization": f"Bearer {token}"
},
json={
"query": query
})
print(base64.b64decode(r.json()["data"]["search"]["pageInfo"]["endCursor"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment