Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iulspop opened this issue Nov 4, 2022 · 0 comments
Open

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

iulspop opened this issue Nov 4, 2022 · 0 comments

Comments

@iulspop
Copy link

iulspop commented Nov 4, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant