我正在尝试通过 gitHub api 跟踪 gitHub 版本的 download_count 。我不需要太多,我只是想看看它是什么。
我正在尝试获取此信息:http ://developer.github.com/v3/repos/releases/#response
从 URL 中可以看到,返回包含一个“download_count”键,但不幸的是,我的资产数组完全是空的。
通过使用这个:
NSString * owner = @"...";
NSString * repo = @"...";
NSString * repoId = @"...";
// Get Release Info
NSString * releaseURL = [NSString stringWithFormat:@"https://api.github.com/repos/%@/%@/releases", owner, repo];
// Get Assets List Specifically
NSString * assetsURL = [NSString stringWithFormat:@"https://api.github.com/repos/%@/%@/releases/%@/assets", owner, repo, repoId];
NSURL * gitAssetsURL = [NSURL URLWithString:releaseURL];
NSData * gitAssetsRawData = [NSData dataWithContentsOfURL:gitAssetsURL];
NSString * gitDataString = [[NSString alloc] initWithData :gitAssetsRawData encoding:NSASCIIStringEncoding];
NSLog(@"%@", gitDataString);
Run Code Online (Sandbox Code Playgroud)
一切输出都很好,但我的资产数组始终为空。我确实有版本,并且所有存储库上的资产数组都是空的。
来自https://developer.github.com/v3/repos/forks/ 上的文档
Forking a Repository happens asynchronously. Therefore, you may have to
wait a short period before accessing the git objects. If this takes longer than
5 minutes, be sure to contact Support.
Run Code Online (Sandbox Code Playgroud)
有没有办法检查fork是否完成?
我想过访问分叉存储库中的单个文件,但我没有足够大的存储库(实际上需要很长时间来分叉)来测试它。
我正在关注GitHub 的使用 API的教程。在我的 Git Bash 命令提示符中,我输入以下内容
curl -i https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
这会像预期的那样引入 JSON。但是,当我输入
curl -i -u your_username https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
它只是打印一个新行,好像在等我完成命令什么的。我需要按下CTRL C才能逃脱。我也尝试过不同的变体,
curl -i -u "your_username" https://api.github.com/users/defunkt
curl -i --user your_username https://api.github.com/users/defunkt
curl -i --user "your_username" https://api.github.com/users/defunkt
curl -i -user your_username https://api.github.com/users/defunkt
curl -i -user "your_username" https://api.github.com/users/defunkt
Run Code Online (Sandbox Code Playgroud)
没有任何效果。我究竟做错了什么?
我正在使用 JSON 更新 GitHub 版本的描述,其中包含该版本的提交列表。
问题是,如果描述有换行符,命令会失败:
Stdout: {
Stdout: "message": "Problems parsing JSON",
Stdout: "documentation_url": "https://developer.github.com/v3"
Stdout: }
Run Code Online (Sandbox Code Playgroud)
我让它工作的唯一方法是用空格替换换行符:
def API_JSON = sprintf ('{"body": "%s"}', description.replace('\n',' '));
Run Code Online (Sandbox Code Playgroud)
但是,如果没有换行符,说明很难阅读。有没有办法使用 API/JSON 设置 GitHub 版本的描述并保留换行符?
我编写了以下函数来验证X-Hub-Signature由 GitHub API 返回的请求标头作为 webhook 负载的一部分。
func isValidSignature(r *http.Request, key string) bool {
// Assuming a non-empty header
gotHash := strings.SplitN(r.Header.Get("X-Hub-Signature"), "=", 2)
if gotHash[0] != "sha1" {
return false
}
defer r.Body.Close()
b, err := ioutil.ReadAll(r.Body)
if err != nil {
log.Printf("Cannot read the request body: %s\n", err)
return false
}
hash := hmac.New(sha1.New, []byte(key))
if _, err := hash.Write(b); err != nil {
log.Printf("Cannot compute the HMAC for request: %s\n", err)
return false
}
expectedHash := …Run Code Online (Sandbox Code Playgroud) 我正在对 GitHub Gist API 进行未经身份验证的调用,并且我已经超出了速率限制。尝试浏览到https://api.github.com/users/seisvelas/gists?page=1&per_page=100,我收到:
{
"message": "API rate limit exceeded for 187.188.105.159. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
Run Code Online (Sandbox Code Playgroud)
我浏览了建议的文档,它建议我查看X-RateLimit-Reset:响应标头,所以我这样做了。我的响应标头如下所示:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1566344009
Run Code Online (Sandbox Code Playgroud)
好的,所以我被允许 60 个请求。但是速率限制重置的时间以1566344009...单位给出。我不确定这些单位的测量单位是什么。毫秒?如果是这样,那将意味着我每 ~18 天允许 60 个请求。这似乎有点保守,但并非不可能,但我更想确切地知道速率限制时间的测量单位是什么。
我没有看到有关文档的任何建议,因此非常感谢任何帮助!谢谢!
将 Bitbucket API 用于任何拉取请求时,未获取 PR 的构建作业详细信息/状态
这是我的 API 网址:
https://example.com/rest/api/1.0/projects/{projectkey}/repos/{reposlug}/pull-requests/{pullrequestID}
Run Code Online (Sandbox Code Playgroud)
构建状态在 GUI 上的样子:
我还尝试了以下方法来获取 Build 状态但没有运气
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks
Run Code Online (Sandbox Code Playgroud)
所以我想知道任何 PR 的构建状态,无论是成功还是失败
提前感谢您的回答。
我正在查看文档,但找不到如何执行此操作。正如标题所说:如何使用 GitHub API 获取用户的固定存储库?
我创建了一个新的 GitHub 应用程序,我正在尝试从 Node.js 进行身份验证。例如,我是 GitHub Apps 的新手,我不知道“installationId”应该是什么。那是应用ID吗?
我使用私钥成功获取了令牌,但是当我尝试使用 API 时,我收到来自 Node 和 curl 的错误。
import { createAppAuth } from '@octokit/auth-app';
import { request } from '@octokit/request';
const privateKey = fs.readFileSync(__dirname + 'file.pem');
const auth = createAppAuth({
id: 1,
privateKey,
installationId: 12345,
clientId: 'xxx.xxxxxx',
clientSecret: 'xxxxxx',
});
const appAuthentication = await auth({ type: 'app' });
console.log(`Git repo token: ` + appAuthentication.token);
const result = await request('GET /orgs/:org/repos', {
headers: {
authorization: 'token ' + appAuthentication.token,
},
org: 'orgname',
type: 'public', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用他们的 v4 graphql 查询 GitHub 以获取有关存储库的信息。我想查询的一件事是 repo 中使用的所有语言的细分。或者,如果可能的话,对用户所有存储库中的语言进行细分。我尝试了以下代码段,但它返回 null,其中主要语言返回主要语言
languages: {
edges: {
node: {
name
}
}
}
Run Code Online (Sandbox Code Playgroud)
我能找到的唯一与语言有关的东西是主要语言。但是我想显示用户的统计信息以及他们在单个存储库中或跨存储库使用的所有语言。
github-api ×10
github ×5
bitbucket ×1
curl ×1
gist ×1
git-bash ×1
github-app ×1
go ×1
graphql ×1
hmacsha1 ×1
ios ×1
jenkins ×1
node.js ×1
octokit-js ×1
release ×1
repository ×1
webhooks ×1