gpt4 book ai didi

ruby - github api v3 创建问题消息未找到

转载 作者:数据小太阳 更新时间:2023-10-29 07:08:10 25 4
gpt4 key购买 nike

当我尝试创建一个 github 问题时,它给出消息未找到回复。以及如何发送身份验证 header 。因为创建问题需要用户登录或验证

curl -X POST -i -d '{"title":"my-new-repo","body":"my new issue description"}' https://api.github.com/repos/barterli/barter.li/issues

HTTP/1.1 404 Not Found
Server: GitHub.com
Date: Wed, 19 Feb 2014 07:11:33 GMT
Content-Type: application/json; charset=utf-8
Status: 404 Not Found
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1392797200
X-GitHub-Media-Type: github.beta
X-Content-Type-Options: nosniff
Content-Length: 86
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 6A33C772:4DE7:9FBE4E:53045924

{
"message": "Not Found",
"documentation_url": "http://developer.github.com/v3"
}

还有如何以 ruby​​ 方式使用 github_api 或 octokit 完成此操作(因为我找不到关于使用它创建问题的文档)目前我所做的是使用 github_api gem

issues = Github::Issues.new user: 'user', repo: 'repo' 它发布到相同的 url ( https://api.github.com/repos/repo/user/issues ) 并且再次找不到页面错误。而且我也不知道如何用它发送身份验证

最佳答案

我猜您遇到问题是因为您正在尝试使用基本身份验证而不是 oauth。这是一个如何使用 github api gem 的示例这样做。

# Init the github api
github_api = Github.new basic_auth: 'login:password'
github_api.oauth.create scopes: ['repo']

# Creating a PR
github_api.pull_requests.create(user: 'username or org goes here', repo: 'repo name goes here',
title: 'example pr title', body: 'example pr body',
head: 'master', base: 'production')
# Creating an issue
github_api.issues.create(user: 'username or org name goes here', repo: 'repo name goes here',
title: "Found a bug",
body: "I'm having a problem with this.",
assignee: "octocat",
milestone: 1,
labels: [
"Label1",
"Label2"
]
)

关于ruby - github api v3 创建问题消息未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21873722/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com