是否可以通过用户位置从 Github Api 获取用户
Is it Possible to Fetch Users fro Github Api by users Location
是否可以通过用户位置从 Github Api 获取用户?
下面这段代码通过用户名获取用户:
async getUser(user) {
const profileResponse = await fetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secrets=${this.client_secret}`);
const profile = await profileResponse.json();
return {
profile
}
}
我目前正在从事 Github Api 项目。
您可以将 Github search users API 与 location
搜索词一起使用:
https://api.github.com/search/users?q=location:france
使用javascript:
var country = "france";
fetch(`https://api.github.com/search/users?q=${encodeURIComponent(`location:${country}`)}`)
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
是否可以通过用户位置从 Github Api 获取用户?
下面这段代码通过用户名获取用户:
async getUser(user) {
const profileResponse = await fetch(`https://api.github.com/users/${user}?client_id=${this.client_id}&client_secrets=${this.client_secret}`);
const profile = await profileResponse.json();
return {
profile
}
}
我目前正在从事 Github Api 项目。
您可以将 Github search users API 与 location
搜索词一起使用:
https://api.github.com/search/users?q=location:france
使用javascript:
var country = "france";
fetch(`https://api.github.com/search/users?q=${encodeURIComponent(`location:${country}`)}`)
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));