Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

ghapi

Latest version: v2.1.6

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
PyPI package Publisher: fastai
687 Stars
68 Forks
2 Versions
19.4M Downloads
Python Repo language

Scan summary

ghapi was last scanned on 29 Nov 2026 at version 2.1.6. Risk score 0 of 100. High-severity rules fired.

  • Releases: 2 versions; the latest was published on 29 Nov 2026.
  • Findings: 1 rule fired in version 2.1.6 (1 high). The score describes this version only.
  • Downloads: 19,362,139 downloads.

Versions

2 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2.1.6 LATEST 29 Nov 2026 1 rule fired
2.1.5 27 Oct 2026 1 rule fired

Rules fired in 2.1.6: 1

Findings

1 High

Findings for v2.1.6. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

Several suspicious behaviors form a known attack pattern

Several behaviors that are each common on their own, such as reading registry credentials, contacting a variable host or running shell commands, appear together in this package in a combination associated with attacks. The finding message lists the behaviors that were combined.

HIGH
Checking access…

🔒 Create a free account to see all 1 finding with descriptions and instance counts

The score describes 2.1.6; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

ghapi

ghapi v2 (July 2026) is now async by default. Every API call is now awaited: res = await api.repos.get(). Top-level await works directly in Jupyter and modern REPLs; in scripts, use asyncio.run. For sync code (which should be largely compatible with v1), use GhApi(sync=True). See the Sync usage section of the docs for details. To stay on the old version, pin ghapi<2.

ghapi provides 100% always-updated coverage of the entire GitHub API. Because we automatically convert the OpenAPI spec to a Pythonic API, ghapi is always up to date with the latest changes to GitHub APIs. Furthermore, because this is all built dynamically from a compact pre-parsed copy of the spec, the package stays small and is always up to date.

Using ghapi, you can automate nearly anything that you can do through the GitHub web interface or through the git client, such as:

There are two ways to use ghapi: either through Python, or from the command line. An overview of each is provided below.

Installation

To install, run pip install ghapi.

How to use - Python

Throughout this documentation, you will see code inputs and outputs shown in this format:

1+1
2

We recommend reading the documentation on the official site, rather than on GitHub, since not all the functionality described on this page is available through the GitHub viewer.

All of the documentation is available directly as Jupyter Notebooks, for instance the current page you’re reading is available as a notebook here. To open any page as an interactive notebook in Google Colab, click the Colab badge at the top of the page.

To access the GitHub API, first create a GhApi object. Note that as of v2, ghapi is async: every endpoint call is awaited. In Jupyter and modern Python REPLs top-level await just works, as shown below; in scripts, wrap your code in a function run with asyncio.run.

from ghapi.all import GhApi
api = GhApi()

Every part of the API includes documentation directly in the api object itself. For instance, here’s how to explore the groups of functionality provided by the API by displaying the object:

api

Then we can explore the endpoints provided by the API in each group, e.g. for the git group:

api.git

Read an endpoint’s full documentation on the generated object. Its display includes parameter descriptions, bound defaults, request controls, and async usage. With pyskills, use doc(api.git.get_ref) for the same documentation, or xdir(api.git, 'ref') to search names. Construction and discovery send no requests:

api.git.get_ref

Get a reference

Docs: https://docs.github.com/rest/git/refs#get-a-reference

Parameters:

  • owner (str, required): The account owner of the repository. The name is not case sensitive.
  • repo (str, required): The name of the repository without the .git extension. The name is not case sensitive.
  • ref (str, required): The Git reference. For more information, see “Git References” in the Git documentation.

Jupyter provides full tab completion and parameter lists for every endpoint. Endpoints are called as standard Python methods:

await api.git.get_ref(owner='fastai', repo='fastcore', ref='heads/master')
{ 'node_id': 'MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy',
  'object': { 'sha': 'c0608379fe60014534c8dffe2e381138e8160f53',
              'type': 'commit',
              'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/commits/c0608379fe60014534c8dffe2e381138e8160f53'},
  'ref': 'refs/heads/master',
  'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/refs/heads/master'}

To use authenticated operations (other than when running through GitHub Actions), you will need a GitHub personal access token. If you don’t have one, click here to create it, choosing the scopes you need (“repo”, “gist”, “notifications”, and “workflow” cover most uses). Save it as an environment variable named GITHUB_TOKEN, e.g. by adding this to your .bashrc or .zshrc:

export GITHUB_TOKEN=xxx

GhApi uses that variable automatically, or you can pass token= explicitly.

As well as token, you can pass any parameters you want auto-inserted into relevant methods, such as owner and repo:

api = GhApi(owner='fastai', repo='fastcore', token=github_token)

We can now repeat the previous method, but only need to pass ref:

await api.git.get_ref('heads/master')
{ 'node_id': 'MDM6UmVmMjI1NDYwNTk5OnJlZnMvaGVhZHMvbWFzdGVy',
  'object': { 'sha': 'c0608379fe60014534c8dffe2e381138e8160f53',
              'type': 'commit',
              'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/commits/c0608379fe60014534c8dffe2e381138e8160f53'},
  'ref': 'refs/heads/master',
  'url': 'https://api.github.com/repos/AnswerDotAI/fastcore/git/refs/heads/master'}

Now that we’ve provided our token, we can use authenticated endpoints such as creating an issue:

issue = await api.issues.create("Remember to check out GhApi!")

Since we’ve now checked out GhApi, let’s close this issue. 😎

await api.issues.update(issue.number, state='closed')

Beyond the endpoints

ghapi also layers task-level conveniences over the generated endpoints – see the GhApi details page for the full set. Highlights: paged/pages iterate any list endpoint; read_issue/read_pr gather a whole issue or PR (body, comments, diff, reviews) in one call; dep_graph/dep_order sort an ecosystem’s repos dependency-first; plus helpers for gists, releases, branches, and repo files. For CI, check_status combines commit statuses and check runs into one verdict, and failed_step_log drills into why a run went red:

api = GhApi(owner='AnswerDotAI', repo='ghapi', token=github_token)
await api.check_status('main')

failure

  • 93199230629 update-pip-graph: success (46s)
  • 93199227080 deploy: failure (22s)

GraphQL

When a read fans out across many repos, the GraphQL client fetches it in a single batch call – issued as parallel chunked requests under the hood, at a fraction of the rate-limit cost of per-repo REST calls. Build schema-checked query fragments by attribute chaining, then batch them: here, the head commit of several repos at once. The same page covers interactive schema discovery, cursor pagination, raw queries, and more:

from ghapi.graphql import GhGql
gql = GhGql()
await gql.batch(*[gql.repository(owner='AnswerDotAI', name=n).defaultBranchRef.target.oid
    for n in ('fastcore', 'fasthtml', 'ghapi')])
['25c4f3228ccac3c5a63da71b5eaa4be3c428f602',
 'e5d967ae627c63035e296e6f319f220e278327e7',
 'ad07893daac86de6693bc9bb57ae7216c1b347d0']

How to use - command line

You can use GhApi via the command line, and can access nearly everything in the GitHub API. We provide an overview here of one of the command line programs, ghapi – see the full CLI docs page for details on all the programs available.

We strongly recommend enabling tab completion for ghapi, which you can do by placing the following command at the end of your ~/.bashrc or ~/.zshrc file:

eval "$(completion-ghapi --install)"

To get started with the ghapi command, first find the name of the operation you wish to perform, for instance by searching the full API reference.

To use ghapi, pass the method name (exactly the same as you’d use in the Python API) as the first parameter, followed by any positional parameters required, and then keyword arguments with “--” before each parameter name.

For instance, git.get_ref takes three parameters: owner, repo, and ref. If we wish to pass the first two as positional parameters, and the last as a named argument, then we’d call:

ghapi git.get_ref fastai ghapi-test --ref heads/master

If you have enabled tab completion, then after you’ve typed ghapi g try pressing Tab, and you’ll see all the operation groups available in the GitHub API that start with g. If you keep typing, e.g. ghapi git., and hit Tab again, you’ll now see all the operations available in the git group, i.e:

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

If you pass just --help after the operation name, you’ll see a full list of all parameters accepted, and a link to the official GitHub documentation.

ghapi git.get_ref --help
>>> git.get_ref(owner, repo, ref)
>>> https://docs.github.com/rest/reference/git#get-a-reference

In addition to --help and the GitHub operation parameters, you can also pass the following:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases ghapi

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Frame 2085668439 (1)
Group 1261154229