A delightful and complete interface to GitHub's amazing API

Overview

ghapi

A delightful and complete interface to GitHub's amazing API

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 done dynamically, the entire package is only 35kB in size!

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 either pip install ghapi or conda install -c fastai 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:

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

Here's how to learn about an endpoint you want to use, e.g.:

api.git.get_ref

git.get_ref(owner, repo, ref): Get a reference

In Jupyter Notebook full tab completion, parameter lists, etc are provided for all endpoints. Endpoints are called as standard Python methods:

api.git.get_ref(owner='fastai', repo='fastcore', ref='heads/master')

To use ghapi to access authenticated operations (other than when running through GitHub Actions), you will need a GitHub personal access token, which is a secret code used to access your account. If you don't have one, click here to create one. You'll be asked to enter a name -- choose anything you like, for instance "ghapi". You'll also be asked to choose "scopes"; this limits what you'll be able to do with the API using this token. If you're not sure, click "repo" "gist", "notifications", and "workflow". Then click "Generate Token" at the bottom of the screen, and copy the token (the long string of letters and numbers shown). You can easily do that by clicking the little clipboard icon next to the token.

Rather than pasting that token into every script, it's easiest to save it as an environment variable. If you save it as $GITHUB_TOKEN then it will be most convenient, so add this to the end of your .bashrc or .zshrc file:

export GITHUB_TOKEN=xxx

...replacing the xxx with the token you just copied. (Don't forget to source that file after you change it.), pass a [GitHub token].

As well as your token, you can also 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:

api.git.get_ref('heads/master')

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

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

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

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

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 --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:

- `--headers`: A list of extra headers to pass, JSON-encoded
- `--token`: A GitHub authentation token
- `--debug`: Print requests before sending them
Comments
  • `HTTP Error 422: Unprocessable Entity` returned for `issues.add_labels` in version `0.1.17`

    `HTTP Error 422: Unprocessable Entity` returned for `issues.add_labels` in version `0.1.17`

    I'm having issues with the ghapi 0.1.17 version released on May, 24th.

    I have a private project where I use ghapi to automatically label PRs and issues based on the path of the files mentioned or modified, and the title of the PR/issue. I am using the following public project to test the workflows and scripts: https://github.com/jhlegarreta/labelertest

    The labeler on the PR/issue title was working fine with ghapi 0.1.16, but it is systematically returning an HTTP Error 422: Unprocessable Entity error for the following call:

    api.issues.add_labels(
                accept="application/vnd.github.v3+json",
                issue_number=pull_request.number, labels=title_labels_to_add)
    

    where the issue_number and labels have the appropriate values.

    Here is an example of a successful call using 0.1.16: https://github.com/jhlegarreta/labelertest/runs/2750092407?check_suite_focus=true#step:5:495

    And here is an example of a successful call using 0.1.17: https://github.com/jhlegarreta/labelertest/runs/2750038846?check_suite_focus=true#step:5:505

    for the same contents from the viewpoint of the files added in the PRs and their titles.

    I have not found any release notes notifying about changes, or an older version of the documentation. According to the latest documentation: https://docs.github.com/en/rest/reference/issues#add-labels-to-an-issue

    I would be providing the expected parameters to the call.

    For what is worth, the 0.1.16 was also working when I only had:

    api.issues.add_labels(pull_request.number, title_labels_to_add)
    

    but 0.1.17 failed as described, so the parameters seem not to be the problem.

    The relevant GitHub workflow file is https://github.com/jhlegarreta/labelertest/blob/main/.github/workflows/pr_title_labeler.yml, and the Python script containing the calls to the ghapi is https://github.com/jhlegarreta/labelertest/blob/main/.github/scripts/pr_title_regex_labeler.py

    Would you please be able to tell what I am doing wrong.

    Thanks for providing us with this valuable tool and thanks for the support.

    bug 
    opened by jhlegarreta 11
  • Moving a Project card results in HTTP422UnprocessableEntityError

    Moving a Project card results in HTTP422UnprocessableEntityError

    What I'm trying to do

    I'm trying to use this library to move a GitHub Project card to the top of its list. The context here is that some cards point to issues with a 🔥 priority label, and I'd like to write a short script that:

    • Loops through each card in a column
    • If that card points to an issue (via content_url), grab the issue's list of labels
    • If priority is in one of the labels, then bump the card to the top of the column.

    What's not working

    Whenever I try to move a card using ghapi, e.g. via:

    api.projects.move_card(59656056, 0)
    

    I get this message:

    HTTP422UnprocessableEntityError: HTTP Error 422: Unprocessable Entity
    

    If I debug and look at the URL of the Request object, it doesn't seem quite right

    req.full_url
    > 'https://api.github.com/projects/columns/cards/59656056/moves'
    

    I'm not sure if I'm doing something wrong, or if this is a bug. So, opening it in case others have a suggestion :-)

    opened by choldgraf 11
  • Example for pagination doesn't seem to work

    Example for pagination doesn't seem to work

    The docs don't mention where to get paged. I'm guessing it's from ghapi.page import paged. Anyway, when trying to follow the example I get:

    In [82]: repos = api.repos.list_for_org('<...>')                                                                                                                                             
    In [83]: len(repos)                                                                                                                                                                                
    Out[83]: 30                                                                                                                                                                                        
    
    In [84]: repos_paged = paged(api.repos.list_for_org('<...>'))                                                                                                                                
    In [85]: for page in repos_paged: print(len(page), page[0].name)                                                                                                                                   
    ---------------------------------------------------------------------------                                                                                                                        
    TypeError                                 Traceback (most recent call last)                                                                                                                        
    <ipython-input-85-f32e698c6d18> in <module>                                                                                                                                                        
    ----> 1 for page in repos_paged: print(len(page), page[0].name)                                                                                                                                    
                                                                                                                                                                                                       
    ~/git/github-analysis/lib/python3.8/site-packages/ghapi/page.py in paged(oper, per_page, max_pages, *args, **kwargs)                                                                               
         14 def paged(oper, *args, per_page=30, max_pages=9999, **kwargs):                                                                                                                             
         15     "Convert operation `oper(*args,**kwargs)` into an iterator"                                                                                                                            
    ---> 16     yield from itertools.takewhile(noop, (oper(*args, per_page=per_page, page=i, **kwargs) for i in range(1,max_pages+1)))                                                                 
         17                                                                                                                                                                                            
         18 # Cell                                                                                                                                                                                     
                                                                                                                                                                                                       
    ~/git/github-analysis/lib/python3.8/site-packages/ghapi/page.py in <genexpr>(.0)                                                                                                                   
         14 def paged(oper, *args, per_page=30, max_pages=9999, **kwargs):                                                                                                                             
         15     "Convert operation `oper(*args,**kwargs)` into an iterator"                                                                                                                            
    ---> 16     yield from itertools.takewhile(noop, (oper(*args, per_page=per_page, page=i, **kwargs) for i in range(1,max_pages+1)))                                                                 
         17                                                                                                                                                                                            
         18 # Cell                                                                                                                                                                                     
                                                                                                                                                                                                       
    TypeError: 'L' object is not callable                  
    
    opened by jean 9
  • Fix ability to define scopes

    Fix ability to define scopes

    Currently the library raises an HTTP 400 Bad Request when scopes are passed to GhDeviceAuth because we attempt to serialise a one-tuple containing an iterable, instead of the iterable itself.

    This change fixes auth to maintain the iterable all the way through so that serialisation works and the API can understand the scopes we send it.

    Note to reviewers: I've not seen a codebase like this before, it looks like all the code is auto-generated from the notebooks? Can I rely on the package codegen working for me here?

    bug 
    opened by danpalmer 8
  • Gettings Started action broken for PR from fork.

    Gettings Started action broken for PR from fork.

    Hello. This is more a question about how to do this... I am trying to create a small Action that would post a comment on a PR after it has been created, but I have no success if the PR comes from a fork. I am using the "getting started" action from the documentation. I get the following error:

    >> Creating comment on PR #225
    [532](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:532)
    Traceback (most recent call last):
    [533](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:533)
      File ".github/scripts/open_in_colab.py", line 57, in <module>
    [534](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:534)
        create_comment()
    [535](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:535)
      File ".github/scripts/open_in_colab.py", line 55, in create_comment
    [536](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:536)
        api.issues.create_comment(issue_number=issue, body=body)
    [537](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:537)
      File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ghapi/core.py", line 63, in __call__
    [538](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:538)
        return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
    [539](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:539)
      File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/ghapi/core.py", line 108, in __call__
    [540](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:540)
        res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
    [541](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:541)
      File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/fastcore/net.py", line 212, in urlsend
    [542](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:542)
        return urlread(req, return_json=return_json, return_headers=return_headers)
    [543](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:543)
      File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/fastcore/net.py", line 113, in urlread
    [544](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:544)
        if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp) from None
    [545](https://github.com/wandb/examples/runs/5813246392?check_suite_focus=true#step:4:545)
    fastcore.basics.HTTP403ForbiddenError: HTTP Error 403: Forbidden
    

    Do I need to change something in the admin of the repo?

    opened by tcapelle 6
  • fix apps.* endpoints that require jwt_token

    fix apps.* endpoints that require jwt_token

    Adds jwt_token attribute to GhApi to allow users to call app endpoints that require a jwt token instead of a pat/access_key

    closes #85

    This should fix and allow you to authenticate to the following endpoints:

    • apps.get_authenticated(): Get the authenticated app
    • apps.list_installations(per_page, page, since, outdated): List installations for the authenticated app
    • apps.get_installation(installation_id): Get an installation for the authenticated app
    • apps.delete_installation(installation_id): Delete an installation for the authenticated app
    • apps.create_installation_access_token(installation_id, repositories, repository_ids, permissions): Create an installation access token for an app
    • apps.suspend_installation(installation_id): Suspend an app installation
    • apps.unsuspend_installation(installation_id): Unsuspend an app installation
    • apps.get_org_installation(org): Get an organization installation for the authenticated app
    • apps.get_repo_installation(owner, repo): Get a repository installation for the authenticated app
    • apps.get_user_installation(username): Get a user installation for the authenticated app
    • apps.get_webhook_config_for_app(): Get a webhook configuration for an app
    • apps.update_webhook_config_for_app(url, content_type, secret, insecure_ssl): Update a webhook configuration for an app
    • apps.get_subscription_plan_for_account_stubbed(account_id): Get a subscription plan for an account (stubbed)
    • apps.list_plans_stubbed(per_page, page): List plans (stubbed)
    • apps.list_accounts_for_plan_stubbed(plan_id, sort, direction, per_page, page): List accounts for a plan (stubbed)

    And probably more, these were just the ones I quickly tested.

    For example:

    jwt = create_jwt(app_id, private_key)
    
    app_api = GhApi(jwt_token=jwt)
    
    print("List Installations")
    installations = app_api.apps.list_installations()
    print(installations)
    
    print("Get Access Token")
    id = installations[0]['id']
    print(app_api.apps.create_installation_access_token(id))
    
    List Installations
    
    [- id: 1111
    - account: 
      - login: ffalor
      - id: 1
      - node_id: MDQ6VXNlcjM1MTQ0MTQx
      #etc...]
    
    Get Access Token
    - token: ghs_324324234234
    - expires_at: 2021-08-21T11:40:36Z
    - permissions: 
      - administration: read
      - contents: read
      - issues: write
      - metadata: read
    - repository_selection: all
    

    Not 100% what all I can update since from my understanding this project is auto generated. I did not see any tests to update. Please let me know what would need to change in order to add the ability to provide a jwt_token.

    Reopen of #87 had to fix line ending changes and auto formatting.

    opened by ffalor 6
  • Add support for media types

    Add support for media types

    For some endpoints GitHub lets you request different response format using the Accept header [1]. However, by default if the response is not in JSON format GhApi.__call__ will raise an error.

    This commit makes it possible by adding a bit of logic to look at the Accept header in the request and tell fastcore.core.urlsend not to return JSON if it doesn't look like the user is requesting a JSON media type.

    enhancement 
    opened by lfdebrux 4
  • Remove need to URL-quote some parameters

    Remove need to URL-quote some parameters

    I just found a gotcha where I was trying to update a github label that had a space in it. Trying to do so was raising a 400 error. I fixed it by doing:

    from urllib.parse import quote
    quote(label["name"])
    

    It would be helpful to either automate this under-the-hood, or to raise a more helpful error that suggests this might be the issue.

    enhancement 
    opened by choldgraf 4
  • UnicodeDecodeError on actions.download_artifact

    UnicodeDecodeError on actions.download_artifact

    I might obviously be missing something, but I'm getting a UnicodeDecodeError, when trying to download an artifact:

    >>> api.actions.download_artifact("YannickJadoul", "Parselmouth", 28315202, "zip")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/yannick/.local/lib/python3.6/site-packages/ghapi/core.py", line 60, in __call__
        return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
      File "/home/yannick/.local/lib/python3.6/site-packages/ghapi/core.py", line 104, in __call__
        route=route or None, query=query or None, data=data or None)
      File "/home/yannick/.local/lib/python3.6/site-packages/fastcore/net.py", line 175, in urlsend
        return urlread(req, return_json=return_json, return_headers=return_headers)
      File "/home/yannick/.local/lib/python3.6/site-packages/fastcore/net.py", line 115, in urlread
        if decode: res = res.decode()
    UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 68-69: invalid continuation byte
    

    It seems like the download bytes are attempted to be decoded to a unicode string? I hope I didn't miss any advice in the docs on how to disable this.

    The issue doesn't seem to be happening for e.g. git.get_blob, because the response there is base64-encoded, while GhApi.get_content does return some bytes (though it's not possible to download artifacts this way, as far as I know).

    opened by YannickJadoul 4
  • Support passing gh_host as argument to GhApi

    Support passing gh_host as argument to GhApi

    This allows users to create multiple instances of GhApi, eg to communicate to both github.com and a private GitHub Enterprise instance.

    gh = GhApi()
    ghe = GhApi(gh_host="https://github.example.com")
    

    It also allows scripts to define a custom GitHub Enterprise host to be used, without requiring the user to remember to pass it explicitly in the environment.

    opened by rshk 3
  • Cannot serialise GitHub issues to JSON

    Cannot serialise GitHub issues to JSON

    Description of the problem

    Hello Jeremy and Hamel,

    I'm trying to use ghapi to fetch issues from a GitHub repo and then dump them to disk as a jsonl file, where each line is an issue.

    The problem I'm running into is that the result from GhAPI.issues.list_for_repo contains fastcore's special L type which appears to not be JSON serialisable. As a result I'm getting the following error: TypeError: Object of type L is not JSON serializable

    Is there a way to make L play nice with JSON?

    Steps to reproduce

    import json
    from ghapi.all import GhApi
    
    api = GhApi()
    issues = api.issues.list_for_repo("huggingface", "transformers", page=1, per_page=5, state="all")
    
    # try to write the first issue
    with open("issues.jsonl", "w") as f:
        json.dump(issues[0], f)
    

    Expected result

    I can write GitHub issues to disk in JSON format.

    Actual result

    Here's the stack trace

    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-48-04139a7641e4> in <module>
          6 
          7 with open("issues.json", "w") as f:
    ----> 8     json.dump(issues[0], f)
    
    ~/miniconda3/envs/transformersbook/lib/python3.8/json/__init__.py in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
        177     # could accelerate with writelines in some versions of Python, at
        178     # a debuggability cost
    --> 179     for chunk in iterable:
        180         fp.write(chunk)
        181 
    
    ~/miniconda3/envs/transformersbook/lib/python3.8/json/encoder.py in _iterencode(o, _current_indent_level)
        429             yield from _iterencode_list(o, _current_indent_level)
        430         elif isinstance(o, dict):
    --> 431             yield from _iterencode_dict(o, _current_indent_level)
        432         else:
        433             if markers is not None:
    
    ~/miniconda3/envs/transformersbook/lib/python3.8/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
        403                 else:
        404                     chunks = _iterencode(value, _current_indent_level)
    --> 405                 yield from chunks
        406         if newline_indent is not None:
        407             _current_indent_level -= 1
    
    ~/miniconda3/envs/transformersbook/lib/python3.8/json/encoder.py in _iterencode(o, _current_indent_level)
        436                     raise ValueError("Circular reference detected")
        437                 markers[markerid] = o
    --> 438             o = _default(o)
        439             yield from _iterencode(o, _current_indent_level)
        440             if markers is not None:
    
    ~/miniconda3/envs/transformersbook/lib/python3.8/json/encoder.py in default(self, o)
        177 
        178         """
    --> 179         raise TypeError(f'Object of type {o.__class__.__name__} '
        180                         f'is not JSON serializable')
        181 
    
    TypeError: Object of type L is not JSON serializable
    

    Versions

    • ghapi: v0.1.16
    opened by lewtun 3
  • pages does not work for list_packages_for_organization

    pages does not work for list_packages_for_organization

    pages function returns only the first page of packages

    api = GhApi(token=gh_token)
    pack_pages = pages(api.packages.list_packages_for_organization, 5, org="my_org", package_type="npm")
    for page in pack_pages:
        for item in page:
            print(item['name'])
    

    this code will print name of the packages from the first page only

    opened by olehm-ma 0
  • ProjectsV2?

    ProjectsV2?

    I'm seeing some weirdness in re: ProjectsV2. Specifically, this command:

    gh api graphql -f query='
      query{
      node(id: "PVT_kwDOAU_qk84AHJ4X") {
        ... on ProjectV2 {
          fields(first: 20) {
            nodes {
              ... on ProjectV2Field {
                id
                name
              }
              ... on ProjectV2IterationField {
                id
                name
                configuration {
                  iterations {
                    startDate
                    id
                  }
                }
              }
              ... on ProjectV2SingleSelectField {
                id
                name
                options {
                  id
                  name
                }
              }
            }
          }
        }
      }
    }'
    

    Works fine against this repo (https://github.com/orgs/filecoin-project/projects/65/views/1).

    However, the same thing in the API:

    gh_token = os.getenv("GITHUB_TOKEN")
    api = GhApi(owner="filecoin-project", token=gh_token)
    
    p = api.projects.list_columns(node="PVT_kwDOAU_qk84AHJ4X", per_page=20, page=0)
    print(f"{p.title} - {p.id}")
    

    Returns not found. Querying issues normally works. Could this be a v2 issue?

    opened by aronchick 2
  • api.repos.create_fork not finding repo but curl command working

    api.repos.create_fork not finding repo but curl command working

    I ran api.repos.create_fork(owner="WebGoat", repo="WebGoat"), and got an error:

    Traceback (most recent call last):
      File "/Users/iulspop/Development/github-app/scripts/e2e/main.py", line 15, in <module>
        api.repos.create_fork(owner="WebGoat", repo="WebGoat")
      File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ghapi/core.py", line 61, in __call__
        return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
      File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ghapi/core.py", line 120, in __call__
        res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=debug, return_headers=True,
      File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/net.py", line 218, in urlsend
        return urlread(req, return_json=return_json, return_headers=return_headers)
      File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/fastcore/net.py", line 119, in urlread
        if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp, msg=e.msg) from None
    fastcore.net.HTTP404NotFoundError: HTTP Error 404: Not Found
    ====Error Body====
    {
      "message": "Not Found",
      "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-fork"
    }
    

    But when I run the curl command directly:

    curl \
      -X POST \
      -H "Accept: application/vnd.github+json" \
      -H "Authorization: Bearer X" \
      https://api.github.com/repos/WebGoat/WebGoat/forks
    

    It just works.

    Any ideas why the ghapi isn't working here?

    opened by iulspop 0
  • use of fast core types prevents basic operations like json.dumps on a response

    use of fast core types prevents basic operations like json.dumps on a response

    afaics the use of fast core types like L prevents basic operations like serializing the response from ghapi.

     >>> json.dumps(o)
    *** TypeError: Object of type L is not JSON serializable
    
    opened by kapilt 0
  • Adding Issue to Project not working

    Adding Issue to Project not working

    Hi, I was having trouble adding an issue as a card on a project using api.projects.create_card. The below stack overflow described my situation exactly, so thanks to the author, and another kind person provided a workaround/solution. I'm also surprised I did not find an issue already opened on this (if I missed it, please forgive me).

    https://stackoverflow.com/questions/70306360/github-api-add-an-issue-to-a-project

    What I encounter when passing the content_id with the issue id and content_type as 'Issue' is a Validation Failed error message.

    api.projects.create_card(column_id=col.id, content_id=issue.id, content_type='Issue')

    ====Error Body====
    {
      "message": "Validation Failed",
      "errors": [
         {
            "resource": "Project Card",
            "code": "unprocessable",
            "field": "data",
            "message": "You must provide either a note or a contentId."
         }
      ],
      "documentation_url": "https://docs.github.com/enterprise/3.3/v3/projects/cards/#create-a-project-card"
    }
    
    opened by rlshuhart 0
  • search query encoding not working

    search query encoding not working

    This works

    curl -v \
      -H "Accept: application/vnd.github+json" \
      -H "Authorization: Bearer $GH_ENTERPRISE_TOKEN" \
      https://$GH_HOST/api/v3/search/issues\?q\=repo:$REPO_NAME+state:open\&per_page=30\&page=
    

    This does not

    from ghapi.all import *
    api = GhApi(<token etc..>)
    paged(api.search.issues_and_pull_requests, q="repo:<REPO_NAME> state:open')
    

    For debug log debug=print_summary

    https://<HOST>/api/v3/search/issues?q=repo%3A<OWNER>%2F<REPO>+state%3Aopen&per_page=30&page=1
    

    See : was replaced with %3A. This I think is what breaks the query, some uri/url encoding happening somewhere

    opened by bob-rohan 1
Releases(1.0.3)
A component of BuzzUtilityBot that allows for inter-server communication

A component of BuzzUtilityBot that allows for inter-server communication! Separated due to privacy and ease of inspection concerns

OHaiiBuzzle 2 Oct 11, 2022
Automatic SystemVerilog linting in github actions with the help of Verible

Verible Lint Action Usage See action.yml This is a GitHub Action used to lint Verilog and SystemVerilog source files and comment erroneous lines of co

CHIPS Alliance 10 Dec 26, 2022
A discord bot that can detect Nitro Scam Links and delete them to protect other users

A discord bot that can detect Nitro Scam Links and delete them to protect other users. Add it to your server from here.

Kanak Mittal 9 Oct 20, 2022
A python package to easy the integration with Direct Online Pay (Mpesa, TigoPesa, AirtelMoney, Card Payments)

A python package to easy the integration with Direct Online Pay (DPO) which easily allow you easily integrate with payment options once without having to deal with each of them individually;

Jordan Kalebu 2 Nov 25, 2021
inventory replenishment for a hospital.

Inventory-Replenishment Inventory-Replenishment for a hospital that would like to explore how advanced anlytics may help automate their decision proce

1 Jan 09, 2022
⚡ Yuriko Robot ⚡ - A Powerful, Smart And Simple Group Manager Written with AioGram , Pyrogram and Telethon

⚡ Yuriko Robot ⚡ - A Powerful, Smart And Simple Group Manager Written with AioGram , Pyrogram and Telethon

Øғғɪᴄɪᴀʟ Ⱡᴏɢ [₳ғᴋ] 1 Apr 01, 2022
⚔️ Fastest tibia bot API

📝 Description tibia bot api using python ⌨ Development ⚙ Running the app python bot.py ✅ ROADMAP Add confidence to floor level to have more accuracy

Lucas Santos 133 Dec 28, 2022
veez music bot is a telegram music bot project, allow you to play music on voice chat group telegram.

🎶 Veez Music Bot Music bot for playing music on telegram voice chat group. Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.7+ PyTgCalls 🧪 Get

levina 143 Jun 19, 2022
Asynchronous python aria2 mirror bot Telegram.

aioaria2-mirror-bot A Bot for Telegram made with Python using Pyrogram library. It needs Python 3.9 or newer to run. THIS BOT IS INTENDED TO BE USED O

Adek 85 Jan 03, 2023
Watches your earnings on EarnApp and notifies you when you earned balance or received an payout.

EarnApp-Earning-Monitor Watches your earnings on EarnApp and notifies you when you earned balance or received an payout. Installation Install Python3

Yariya 21 Oct 17, 2022
Free python/telegram bot for easy execution and surveillance of crypto trading plans on multiple exchanges.

EazeBot Introduction Have you ever traded cryptocurrencies and lost overview of your planned buys/sells? Have you encountered the experience that your

Marcel Beining 100 Dec 06, 2022
Nautobot-custom-jobs - Custom jobs for Nautobot

nautobot-custom-jobs This repo contains custom jobs for Nautobot. Installation P

Dan Peachey 9 Oct 27, 2022
Open Resource Calculator Module for Python

Calculator Module for Python By White Night Install #

White_Night_awa 4 Aug 22, 2022
Python Twitter API

Python Twitter Tools The Minimalist Twitter API for Python is a Python API for Twitter, everyone's favorite Web 2.0 Facebook-style status updater for

Mike Verdone 2.9k Jan 03, 2023
DevSecOps pipeline for Python based web app using Jenkins, Ansible, AWS, and open-source security tools and checks.

DevSecOps pipeline for Python Web App A Jenkins end-to-end DevSecOps pipeline for Python web application, hosted on AWS Ubuntu 20.04 Note: This projec

Devanshu Vashishtha 4 Aug 15, 2022
a harbinger of events or things.

Herald: Intrusion Detection System using IR and ML Herald - noun; a harbinger of events or things. Overview Herald is an intrusion detection system us

Muhammad Muzzammil 4 Jun 07, 2021
Develop and deploy applications with the Ionburst Cloud Python SDK.

Ionburst SDK for Python The Ionburst SDK for Python enables developers to easily integrate with Ionburst Cloud, building in ultra-secure and private o

Ionburst Cloud 3 Mar 06, 2022
Shiny Wechat Pay SDK for Python

WeChat third-party Python SDK master: Read the Documentation Features Common public platforms passively respond and actively call APIs WeChat Pay API

Obrisk 18 Sep 05, 2022
Uma API pública contendo informações sobre o unvierso de Roberto Gomez Bolaños.

Chespirito API Objetivo Esta API tem como objetivo ser um ponto de referência para a procura sobre todo o universo do grande Roberto Gomez Bolaños, ta

Pery Lemke 6 Feb 02, 2022
Send Informative, Concise Slack Notifications With Minimal Effort

slack-templates Send Informative, Concise Slack Notifications With Minimal Effort slack-templates Slack Integration Available Templates Usage Report t

9 Nov 03, 2022