// 응답 내용
{
"message":"Return succeeded.",
"status":200,
"name":"MORA-Team",
"nickname":"모라 Team",
"url":"https://github.com/MORA-Team",
"introduction":null,
"avatarurl":"https://avatars.githubusercontent.com/u/104973461?v=4",
"creation":"2022-05-05T08:00:35Z",
"update":"2022-08-23T23:18:26Z",
"success":true
}
// node-fetch
const fetch = require('node-fetch')
fetch('https://mora-bot.kr/api/v1/github?username=[닉네임]')
.then(res => res.json())
.then(json => {
let imgurl = json.url;
let code = json.code;
console.log(json)
});
// request
let api_url = 'https://mora-bot.kr/api/v1/github?username=[닉네임]'
const request = require('request');
let options = {
url: api_url
}
request.get(options, function (error, response, body) {
if (!error && response.status == 200) {
let imgurl = JSON.parse(body).url;
let code = JSON.parse(body).code;
console.log(imgurl, code)
} else {
console.log('error = ' + response.errorcode);
}
});
import requests
response = requests.get("https://mora-bot.kr/api/v1/github?username=[닉네임]")
result = response.json()
if response.status == 200:
print(result)
else:
print(f"Error Code: {response.errorcode}")