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)
RequestTrackerBot - Request Tracker Bot With Python

Request Tracker Bot This is a Request Tracker Bot repo, It is for those who uplo

Prince Jaiswal 1 Dec 30, 2021
Get charts, top artists and top songs WITHOUT LastFM API

LastFM Get charts, top artists and top songs WITHOUT LastFM API Usage Get stats (charts) We provide many filters and options to customize. Geo filter

4 Feb 11, 2022
Request based Python module(s) to help with the Newegg raffle.

Newegg Shuffle Python module(s) to help you with the Newegg raffle How to use $ git clone https://github.com/Matthew17-21/Newegg-Shuffle $ cd Newegg-S

Matthew 45 Dec 01, 2022
This is a TG Video Compress BoT. Product by BINARY Tech

🌀 Video Compressor Bot Product by BINARY Tech Deploy to Heroku The Hard Way virtualenv -p python3 VENV . ./VENV/bin/activate pip install -r requireme

1 Jan 04, 2022
🎥 Stream your favorite movie from the terminal!

Stream-Cli stream-cli is a Python scrapping CLI that combine scrapy and webtorrent in one command for streaming movies from your terminal. Installatio

R E D O N E 379 Dec 24, 2022
Data and a Twitter bot for the EPA's DOCUMERICA (1972-1977) program.

documerica This repository holds JSON(L) artifacts and a few scripts related to managing archival data from the EPA's DOCUMERICA program. Contents: Ma

William Woodruff 2 Oct 27, 2021
Cloud-optimized, single-file archive format for pyramids of map tiles

PMTiles PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enable

Protomaps 325 Jan 04, 2023
Unofficial WebApp for WhatsApp Web created in PyQt6

Unofficial WebApp for WhatsApp Web created in PyQt6 using PyQt6-WebEngine

Rafael Tosta Santos 126 Dec 20, 2022
Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord.

python-snowflake-2 Based on falcondai and fenhl's Python snowflake tool, but with documentation and simliarities to Discord. Docs make_snowflake This

2 Mar 19, 2022
Telegram bot with various Sticker Tools

Sticker Tools Bot @Sticker_Tools_Bot A star ⭐ from you means a lot to us! Telegram bot with various Sticker Tools Usage Deploy to Heroku Tap on above

Stark Bots 20 Dec 08, 2022
Repository for the Nexus Client software.

LinkScope Client Description This is the repository for the LinkScope Client Online Investigation software. LinkScope allows you to perform online inv

107 Dec 30, 2022
This is a simple unofficial async Api-wrapper for tio.run

Async-Tio This is a simple unofficial async Api-wrapper for tio.run

Tom-the-Bomb 7 Oct 28, 2022
A discord bot made by the community (uses python)

discord community bot context: this is a discord bot made by the community by community i mean people adding commands to the bot or changing the bot b

TR ASH 0 Oct 11, 2022
🤖 The bot that runs the official Fairfield Programming Association Discord server.

🤖 The bot that runs the official Fairfield Programming Association Discord server.

Fairfield Programming Association 1 Jan 07, 2022
qualysclient - a python SDK for interacting with the Qualys API

qualysclient - a python SDK for interacting with the Qualys API

5 Oct 28, 2022
Video Stream is a telegram bot project that's allow you to play video on telegram group video chat

Video Stream is a telegram bot project that's allow you to play video on telegram group video chat 🚀 Get SESSION_NAME from below: Pyrogram ## ✨ Featu

1 Nov 10, 2021
The EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy

EscapePod Extension SDK for Python by cyb3rdog This is the EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy. With this SDK, you can: m

cyb3rdog 3 Mar 07, 2022
An api, written in Python, for Investopedia's paper trading stock simulator.

investopedia-trading-api An API, written in Python, for Investopedia's paper trading stock simulator. Pull requests welcome. This library is now Pytho

Kirk Thaker 178 Jan 06, 2023
KaydyPurge - Python Purge Script for Discord made by Kaydy Cain#0001

How to Install Open terminal Execute "git clone https://github.com/apolo1337/Kay

apolo 5 Jan 27, 2022
A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studying.

Studying RPC Description A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studyin

John Edmerson Pizarra 4 Nov 19, 2022