githubのAPIをリクエストしようとしています。ここに私の要求は次のとおりです。リクエストのリクエスト機能を使用しているときにGithub APIが403で応答しています
Request forbidden by administrative rules. Please make sure your request has a User-Agent header (http://developer.github.com/v3/#user-agent-required). Check https://developer.github.com for other possible causes.
私が過去にまったく同じコードを使用している、それが働いている:
var url = 'https://api.github.com/' + requestUrl + '/' + repo + '/';
request(url, function(err, res, body) {
if (!err && res.statusCode == 200) {
var link = "https://github.com/" + repo;
opener(link);
process.exit();
} else {
console.log(res.body);
console.log(err);
console.log('This ' + person + ' does not exist');
process.exit();
}
});
これは私が私の応答を得るものです。要求によってエラーはスローされません。今私はなぜ403(禁じられた)が得られているのかと混同されますか?どんな解決策ですか?
は、ユーザーエージェントヘッダーを追加するか、単にgithubのAPIのNPM上のモジュール(複数可)を使用します。 –