{"id":21633379,"url":"https://github.com/answerdotai/ghapi","last_synced_at":"2026-02-28T02:00:41.770Z","repository":{"id":39987630,"uuid":"314706418","full_name":"AnswerDotAI/ghapi","owner":"AnswerDotAI","description":"A delightful and complete interface to GitHub's amazing API","archived":false,"fork":false,"pushed_at":"2025-04-10T14:57:46.000Z","size":5518,"stargazers_count":657,"open_issues_count":50,"forks_count":67,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-08T13:48:39.338Z","etag":null,"topics":["api-client","github","github-api","nbdev","openapi"],"latest_commit_sha":null,"homepage":"https://ghapi.fast.ai/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnswerDotAI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-21T01:10:28.000Z","updated_at":"2025-05-07T01:00:28.000Z","dependencies_parsed_at":"2024-04-04T02:41:25.824Z","dependency_job_id":"594b3eee-b5fe-42e9-adae-da0de5fa1acc","html_url":"https://github.com/AnswerDotAI/ghapi","commit_stats":{"total_commits":269,"total_committers":17,"mean_commits":"15.823529411764707","dds":"0.22304832713754652","last_synced_commit":"b77bfaebd937a3b7527b117a5e43d99bcb98b39d"},"previous_names":["answerdotai/ghapi","fastai/ghapi"],"tags_count":20,"template":false,"template_full_name":"fastai/nbdev_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fghapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fghapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fghapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fghapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnswerDotAI","download_url":"https://codeload.github.com/AnswerDotAI/ghapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301420,"owners_count":22047901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","github","github-api","nbdev","openapi"],"created_at":"2024-11-25T03:01:00.475Z","updated_at":"2025-12-12T01:04:25.308Z","avatar_url":"https://github.com/AnswerDotAI.png","language":"Jupyter Notebook","readme":"# ghapi\n\n\n\u003c!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --\u003e\n\n[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) provides 100%\nalways-updated coverage of the entire [GitHub\nAPI](https://docs.github.com/rest). Because we automatically convert the\n[OpenAPI\nspec](https://docs.github.com/rest/overview/openapi-description) to a\nPythonic API, [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) is always\nup to date with the latest changes to GitHub APIs. Furthermore, because\nthis is all done dynamically, the entire package is only 35kB in size!\n\nUsing [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), you can automate\nnearly anything that you can do through the GitHub web interface or\nthrough the `git` client, such as:\n\n- Open, list, comment on, or modify\n  [issues](https://guides.github.com/features/issues/) or [pull\n  requests](https://docs.github.com/github/collaborating-with-issues-and-pull-requests/about-pull-requests)\n- Create, list, or modify [git\n  tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) or [GitHub\n  releases](https://docs.github.com/github/administering-a-repository/managing-releases-in-a-repository),\n  including uploading release assets\n- Configure and run GitHub\n  [Actions](https://github.com/features/actions) and\n  [webhooks](https://docs.github.com/developers/webhooks-and-events/about-webhooks)\n- Set up GitHub [users](https://docs.github.com/rest/reference/users)\n  and\n  [organizations](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/about-organizations)\n- Manage your\n  [deployments](https://docs.github.com/rest/guides/delivering-deployments)\n- …and much, much more.\n\nThere are two ways to use\n[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi): either through Python,\nor from the command line. An overview of each is provided below.\n\n## Installation\n\nTo install, run either `pip install ghapi` or\n`conda install -c fastai ghapi`.\n\n## How to use - Python\n\nThroughout this documentation, you will see code inputs and outputs\nshown in this format:\n\n``` python\n1+1\n```\n\n    2\n\nWe recommend reading the documentation on the [official\nsite](https://ghapi.fast.ai/), rather than on GitHub, since not all the\nfunctionality described on this page is available through the GitHub\nviewer.\n\nAll of the documentation is available directly as Jupyter Notebooks, for\ninstance the current page you’re reading is available as a notebook\n[here](https://github.com/fastai/ghapi/blob/master/index.ipynb). To open\nany page as an interactive notebook in Google Colab, click the *Colab*\nbadge at the top of the page.\n\nTo access the GitHub API, first create a\n[`GhApi`](https://ghapi.fast.ai/core.html#ghapi) object:\n\n``` python\nfrom ghapi.all import GhApi\napi = GhApi()\n```\n\nEvery part of the API includes documentation directly in the `api`\nobject itself. For instance, here’s how to explore the groups of\nfunctionality provided by the API by displaying the object:\n\n``` python\napi\n```\n\n- [actions](https://docs.github.com/rest/reference/actions)\n- [activity](https://docs.github.com/rest/reference/activity)\n- [api_insights](https://docs.github.com/rest/reference/api-insights)\n- [apps](https://docs.github.com/rest/reference/apps)\n- [billing](https://docs.github.com/rest/reference/billing)\n- [checks](https://docs.github.com/rest/reference/checks)\n- [classroom](https://docs.github.com/rest/reference/classroom)\n- [code_scanning](https://docs.github.com/rest/reference/code-scanning)\n- [code_security](https://docs.github.com/rest/reference/code-security)\n- [codes_of_conduct](https://docs.github.com/rest/reference/codes-of-conduct)\n- [codespaces](https://docs.github.com/rest/reference/codespaces)\n- [copilot](https://docs.github.com/rest/reference/copilot)\n- [dependabot](https://docs.github.com/rest/reference/dependabot)\n- [dependency_graph](https://docs.github.com/rest/reference/dependency-graph)\n- [emojis](https://docs.github.com/rest/reference/emojis)\n- [gists](https://docs.github.com/rest/reference/gists)\n- [git](https://docs.github.com/rest/reference/git)\n- [gitignore](https://docs.github.com/rest/reference/gitignore)\n- [hosted_compute](https://docs.github.com/rest/reference/hosted-compute)\n- [interactions](https://docs.github.com/rest/reference/interactions)\n- [issues](https://docs.github.com/rest/reference/issues)\n- [licenses](https://docs.github.com/rest/reference/licenses)\n- [markdown](https://docs.github.com/rest/reference/markdown)\n- [meta](https://docs.github.com/rest/reference/meta)\n- [migrations](https://docs.github.com/rest/reference/migrations)\n- [oidc](https://docs.github.com/rest/reference/oidc)\n- [orgs](https://docs.github.com/rest/reference/orgs)\n- [packages](https://docs.github.com/rest/reference/packages)\n- [private_registries](https://docs.github.com/rest/reference/private-registries)\n- [projects](https://docs.github.com/rest/reference/projects)\n- [pulls](https://docs.github.com/rest/reference/pulls)\n- [rate_limit](https://docs.github.com/rest/reference/rate-limit)\n- [reactions](https://docs.github.com/rest/reference/reactions)\n- [repos](https://docs.github.com/rest/reference/repos)\n- [search](https://docs.github.com/rest/reference/search)\n- [secret_scanning](https://docs.github.com/rest/reference/secret-scanning)\n- [security_advisories](https://docs.github.com/rest/reference/security-advisories)\n- [teams](https://docs.github.com/rest/reference/teams)\n- [users](https://docs.github.com/rest/reference/users)\n\nThen we can explore the endpoints provided by the API in each group,\ne.g. for the `git` group:\n\n``` python\napi.git\n```\n\n- [git.create_blob](https://docs.github.com/rest/git/blobs#create-a-blob)(owner,\n  repo, content, encoding): *Create a blob*\n- [git.get_blob](https://docs.github.com/rest/git/blobs#get-a-blob)(owner,\n  repo, file_sha): *Get a blob*\n- [git.create_commit](https://docs.github.com/rest/git/commits#create-a-commit)(owner,\n  repo, message, tree, parents, author, committer, signature): *Create a\n  commit*\n- [git.get_commit](https://docs.github.com/rest/git/commits#get-a-commit-object)(owner,\n  repo, commit_sha): *Get a commit object*\n- [git.list_matching_refs](https://docs.github.com/rest/git/refs#list-matching-references)(owner,\n  repo, ref): *List matching references*\n- [git.get_ref](https://docs.github.com/rest/git/refs#get-a-reference)(owner,\n  repo, ref): *Get a reference*\n- [git.create_ref](https://docs.github.com/rest/git/refs#create-a-reference)(owner,\n  repo, ref, sha): *Create a reference*\n- [git.update_ref](https://docs.github.com/rest/git/refs#update-a-reference)(owner,\n  repo, ref, sha, force): *Update a reference*\n- [git.delete_ref](https://docs.github.com/rest/git/refs#delete-a-reference)(owner,\n  repo, ref): *Delete a reference*\n- [git.create_tag](https://docs.github.com/rest/git/tags#create-a-tag-object)(owner,\n  repo, tag, message, object, type, tagger): *Create a tag object*\n- [git.get_tag](https://docs.github.com/rest/git/tags#get-a-tag)(owner,\n  repo, tag_sha): *Get a tag*\n- [git.create_tree](https://docs.github.com/rest/git/trees#create-a-tree)(owner,\n  repo, tree, base_tree): *Create a tree*\n- [git.get_tree](https://docs.github.com/rest/git/trees#get-a-tree)(owner,\n  repo, tree_sha, recursive): *Get a tree*\n\nHere’s how to learn about an endpoint you want to use, e.g.:\n\n``` python\napi.git.get_ref\n```\n\n[git.get_ref](https://docs.github.com/rest/git/refs#get-a-reference)(owner,\nrepo, ref): *Get a reference*\n\nIn Jupyter Notebook full tab completion, parameter lists, etc are\nprovided for all endpoints. Endpoints are called as standard Python\nmethods:\n\n``` python\napi.git.get_ref(owner='fastai', repo='fastcore', ref='heads/master')\n```\n\n``` json\n{ 'node_id': 'MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy',\n  'object': { 'sha': 'c0608379fe60014534c8dffe2e381138e8160f53',\n              'type': 'commit',\n              'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/commits/c0608379fe60014534c8dffe2e381138e8160f53'},\n  'ref': 'refs/heads/master',\n  'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/refs/heads/master'}\n```\n\nTo use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) to access\nauthenticated operations (other than when running through GitHub\nActions), you will need a GitHub [personal access\ntoken](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token),\nwhich is a secret code used to access your account. If you don’t have\none, [click here](https://github.com/settings/tokens/new) to create one.\nYou’ll be asked to enter a name – choose anything you like, for instance\n“*ghapi*”. You’ll also be asked to choose “scopes”; this limits what\nyou’ll be able to do with the API using this token. If you’re not sure,\nclick “*repo*” “*gist*”, “*notifications*”, and “*workflow*”. Then click\n“Generate Token” at the bottom of the screen, and copy the token (the\nlong string of letters and numbers shown). You can easily do that by\nclicking the little clipboard icon next to the token.\n\nRather than pasting that token into every script, it’s easiest to save\nit as an environment variable. If you save it as `$GITHUB_TOKEN` then it\nwill be most convenient, so add this to the end of your `.bashrc` or\n`.zshrc` file:\n\n    export GITHUB_TOKEN=xxx\n\n…replacing the `xxx` with the token you just copied. (Don’t forget to\n`source` that file after you change it.), pass a \\[GitHub token\\].\n\nAs well as your `token`, you can also pass any parameters you want\nauto-inserted into relevant methods, such as `owner` and `repo`:\n\n``` python\napi = GhApi(owner='fastai', repo='fastcore', token=github_token)\n```\n\nWe can now repeat the previous method, but only need to pass `ref`:\n\n``` python\napi.git.get_ref('heads/master')\n```\n\n``` json\n{ 'node_id': 'MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy',\n  'object': { 'sha': 'c0608379fe60014534c8dffe2e381138e8160f53',\n              'type': 'commit',\n              'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/commits/c0608379fe60014534c8dffe2e381138e8160f53'},\n  'ref': 'refs/heads/master',\n  'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/refs/heads/master'}\n```\n\nNow that we’ve provided our token, we can use authenticated endpoints\nsuch as creating an issue:\n\n``` python\nissue = api.issues.create(\"Remember to check out GhApi!\")\n```\n\nSince we’ve now checked out GhApi, let’s close this issue. 😎\n\n``` python\napi.issues.update(issue.number, state='closed')\n```\n\n## How to use - command line\n\nYou can use [`GhApi`](https://ghapi.fast.ai/core.html#ghapi) via the\ncommand line, and can access nearly everything in the [GitHub\nAPI](https://docs.github.com/rest). We provide an overview here of one\nof the command line programs,\n[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi) – see the full CLI docs\npage for details on all the programs available.\n\nWe strongly recommend enabling tab completion for\n[`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), which you can do by\nplacing the following command at the end of your `~/.bashrc` or\n`~/.zshrc` file:\n\n``` bash\neval \"$(completion-ghapi --install)\"\n```\n\nTo get started with the [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi)\ncommand, first find the name of the operation you wish to perform, for\ninstance by searching the [full API\nreference](https://ghapi.fast.ai/fullapi.html).\n\nTo use [`ghapi`](https://ghapi.fast.ai/cli.html#ghapi), pass the method\nname (exactly the same as you’d use in the Python API) as the first\nparameter, followed by any positional parameters required, and then\nkeyword arguments with “`--`” before each parameter name.\n\nFor instance, [git.get_ref](https://ghapi.fast.ai/fullapi.html#git)\ntakes three parameters: `owner`, `repo`, and `ref`. If we wish to pass\nthe first two as positional parameters, and the last as a named\nargument, then we’d call:\n\n``` bash\nghapi git.get_ref fastai ghapi-test --ref heads/master\n```\n\nIf you have enabled tab completion, then after you’ve typed `ghapi g`\ntry pressing \u003ckbd\u003eTab\u003c/kbd\u003e, and you’ll see all the operation groups\navailable in the GitHub API that start with `g`. If you keep typing,\ne.g. `ghapi git.`, and hit \u003ckbd\u003eTab\u003c/kbd\u003e again, you’ll now see all the\noperations available in the `git` group, i.e:\n\n    git.create_blob git.create_commit git.create_ref git.create_tag git.create_tree git.delete_ref git.get_blob git.get_commit git.get_ref git.get_tag git.get_tree git.list_matching_refs git.name git.update_ref git.verbs\n\nIf you pass just `--help` after the operation name, you’ll see a full\nlist of all parameters accepted, and a link to the official GitHub\ndocumentation.\n\n``` bash\nghapi git.get_ref --help\n\u003e\u003e\u003e git.get_ref(owner, repo, ref)\n\u003e\u003e\u003e https://docs.github.com/rest/reference/git#get-a-reference\n```\n\nIn addition to `--help` and the GitHub operation parameters, you can\nalso pass the following:\n\n- `--headers`: A list of extra headers to pass, JSON-encoded\n- `--token`: A GitHub authentation token\n- `--debug`: Print requests before sending them\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Fghapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanswerdotai%2Fghapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Fghapi/lists"}