Skip to content

Instantly share code, notes, and snippets.

View nasifimtiazohi's full-sized avatar
🇧🇩

Nasif Imtiaz nasifimtiazohi

🇧🇩
View GitHub Profile
@nasifimtiazohi
nasifimtiazohi / graphql_example.py
Created May 14, 2020 19:11 — forked from gbaman/graphql_example.py
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200: