我正在尝试使用GitHub API V3仅通过关键字搜索一些代码,不限制用户、组织或存储库。
例如,如果我想搜索包含关键字“addClass”的所有代码片段,则结果将是https://github.com/search?q=addClass&type=Code&ref=searchresults(不使用 GitHub API)。
但是,如何通过GitHub API完成同样的事情?我尝试了https://api.github.com/search/code?q=addClass,但它显示“必须至少包括一个用户、组织或存储库”。我该如何解决这个问题?
{ "message": "Must specify access token via Authorization header. https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param", "documentation_url": "https://docs.github.com/v3/#oauth2-token-sent-in-a-header" }
- Luk Aron