Skip to content

Instantly share code, notes, and snippets.

@cmdoret
Last active February 7, 2023 02:50
Show Gist options
  • Save cmdoret/0c0d134704129f7bf195f57294c680df to your computer and use it in GitHub Desktop.
Save cmdoret/0c0d134704129f7bf195f57294c680df to your computer and use it in GitHub Desktop.
Github GraphQL query for Gimie
import os
import requests
TOKEN = os.getenv('ACCESS_TOKEN')
body = """
{
viewer {
login
}
repository(name: "renku", owner: "SwissDataScienceCenter") {
owner {
login
avatarUrl
... on User {
company
name
organizations(first: 100) {
edges {
node {
avatarUrl
description
email
login
name
}
}
}
email
login
}
}
createdAt
name
updatedAt
url
latestRelease {
name
releaseAssets(first: 10) {
nodes {
downloadUrl
}
}
}
primaryLanguage {
name
}
mentionableUsers(first: 100) {
nodes {
login
name
avatarUrl
company
organizations(first: 100) {
nodes {
avatarUrl
description
name
login
}
}
}
}
}
}
"""
url = "https://api.github.com/graphql"
resp = requests.post(url=url, json={'query': body}, headers={"Authorization": "bearer " + TOKEN})
if resp.status_code == 200:
print(resp.content)
else:
print(resp)
print(resp.__dict__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment