Unstructured noodling about with the GitHub API from Python
Noodle 1: ght.py
A small subclass of requests.Session that avoids having to specify the GitHub API url every time and also takes care of tokens and pagination.
Noodle 2: main.py
Expects you to have a GitHib token in the environment variable and uses it to illustrate the use of the GHapiSession class from ght.py
~/wip/github-api-noodling$ LOGLEVEL=debug python3 -m ghnoodle.main "users/janko" | jq -S .
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.github.com:443
DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /users/janko HTTP/1.1" 200 None
[
{
"avatar_url": "https://avatars.githubusercontent.com/u/795488?v=4",
"bio": "Ruby developer, open source contributor, author of @shrinerb and rodauth-rails",
"blog": "https://janko.io",
"company": "ButterflyMX",
"created_at": "2011-05-18T10:05:43Z",
"email": "janko@hey.com",
"events_url": "https://api.github.com/users/janko/events{/privacy}",
"followers": 802,
"followers_url": "https://api.github.com/users/janko/followers",
"following": 26,
"following_url": "https://api.github.com/users/janko/following{/other_user}",
"gists_url": "https://api.github.com/users/janko/gists{/gist_id}",
"gravatar_id": "",
"hireable": true,
"html_url": "https://github.com/janko",
"id": 795488,
"location": "Brno, Czechia",
"login": "janko",
"name": "Janko Marohnić",
"node_id": "MDQ6VXNlcjc5NTQ4OA==",
"organizations_url": "https://api.github.com/users/janko/orgs",
"public_gists": 47,
"public_repos": 188,
"received_events_url": "https://api.github.com/users/janko/received_events",
"repos_url": "https://api.github.com/users/janko/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/janko/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/janko/subscriptions",
"twitter_username": null,
"type": "User",
"updated_at": "2025-08-19T19:10:09Z",
"url": "https://api.github.com/users/janko",
"user_view_type": "public"
}
]