GitHub API

GitHub is now the ubiquituous home for developers - query the GitHub API using this tutorial to get started building fine grained analytics on repos across GitHub.

Authentication

Get an access token here - (https://github.com/settings/tokens?type=beta)[https://github.com/settings/tokens?type=beta]. You'll need the token to access the API.

This simple example queries the API for all repos on the user's profile.

import micropip
await micropip.install('pygithub')
await micropip.install('ssl')

from github import Github

# Authentication is defined via github.Auth
from github import Auth

# using an access token - get token here: https://github.com/settings/tokens?type=beta
auth = Auth.Token("access-token-here")

# First create a Github instance:

# Public Web Github
g = Github(auth=auth)

# Then play with your Github objects:
for repo in g.get_user().get_repos():
    print(repo.name)

# To close connections after use
g.close()

For the full reference to learn what's possible - (https://pygithub.readthedocs.io/en/stable/)[https://pygithub.readthedocs.io/en/stable/].

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The spreadsheet with AI.

Use Quadratic for free