Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#154 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
github, python
领域
api

调研方向

从 scripts/e2e/main.py 中的调用开始,跟踪它经过 ghapi/core.py 和 fastcore/net.py 的过程,并将生成的请求与发送到 GitHub forks 端点且能够正常工作的 curl 请求进行比较。完成的标准是确定两个请求存在差异的原因,并记录或修正相关行为,使 Python 调用能够针对该 repository 成功执行。

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
Python
星标
687
派生
69
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AnswerDotAI/ghapi 的其他 Issue

查看 AnswerDotAI/ghapi 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。