Copy // 응답 내용
{
"message" : "captcha image and code was returned" ,
"status" : 200 ,
"url" : "https://dummyimage.com/2000x500/ffffff/33363c&text=snZojQ" ,
"code" : "snZojQ" ,
"success" : true
}
Copy // node-fetch
const fetch = require ( 'node-fetch' )
fetch ( 'https://mora-bot.kr/api/v1/captcha' )
.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/captcha'
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);
}
});
Copy import requests
response = requests . get ( "https://mora-bot.kr/api/v1/captcha" )
result = response . json ()
if response . status == 200 :
print (result)
else :
print ( f "Error Code: { response.errorcode } " )