fastai / ghapi

A delightful and complete interface to GitHub's amazing API
https://ghapi.fast.ai/
Apache License 2.0
526 stars 57 forks source link

Unable to delete packages for user #132

Open stumpylog opened 2 years ago

stumpylog commented 2 years ago

When using this API from within a GitHub Action, the API returns a 404 error when attempting to use delete_package_version_for_authenticated_user. However, doing a manual curl command to the same URL (with auth token) succeeded.

{'data': None,
 'full_url': 'https://api.github.com/user/packages/container/paperless-ngx/versions/16658258',
 'headers': {'Accept': 'application/vnd.github.v3+json'},
 'method': 'DELETE'}
    _main()
  File "/home/runner/work/paperless-ngx/paperless-ngx/.github/scripts/cleanup-tags.py", line 197, in _main
    api.packages.delete_package_version_for_authenticated_user(
  File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/ghapi/core.py", line 63, in __call__
    return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
  File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/ghapi/core.py", line 112, in __call__
    res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
  File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/fastcore/net.py", line 212, in urlsend
    return urlread(req, return_json=return_json, return_headers=return_headers)
  File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/site-packages/fastcore/net.py", line 113, in urlread
    if 400 <= e.code < 500: raise ExceptionsHTTP[e.code](e.url, e.hdrs, e.fp) from None
fastcore.basics.HTTP404NotFoundError: HTTP Error 404: Not Found

vs

curl -X DELETE -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ghp_*************" https://api.github.com/user/packages/container/paperless-ngx/versions/16658258

Previously in the same code, get_all_package_versions_for_package_owned_by_authenticated_user worked without issue, so I don't believe it is an access issue.