Created
March 31, 2021 17:55
-
-
Save bertrandmartel/34a3db0a8f223a9d14f07ddaa0329d49 to your computer and use it in GitHub Desktop.
Github Graphql API cursor decoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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