박찬수

Upload Project

Showing 1 changed file with 27 additions and 7 deletions
1 -var request = require('request'); 1 +// var request = require('request');
2 - var options = { 2 +// var options = {
3 +// method: 'GET',
4 +// url: 'https://v3.football.api-sports.io/players',
5 +// qs: {id: 276, season: 2019},
6 +// headers: {
7 +// 'x-rapidapi-host': 'v3.football.api-sports.io',
8 +// 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
9 +// }
10 +// };
11 +// request(options, function (error, response) {
12 +// if (error) throw new Error(error);
13 +// });
14 +var request = require("request");
15 +
16 +var options = {
3 method: 'GET', 17 method: 'GET',
4 - url: 'https://v3.football.api-sports.io/players', 18 + url: 'https://v3.football.api-sports.io/standings',
5 - qs: {id: 276, season: 2019}, 19 + qs: {league: '39', season: '2021'},
6 headers: { 20 headers: {
7 'x-rapidapi-host': 'v3.football.api-sports.io', 21 'x-rapidapi-host': 'v3.football.api-sports.io',
8 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191' 22 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
9 } 23 }
10 - }; 24 +};
11 - request(options, function (error, response) { 25 +
26 +request(options, function (error, response, body) {
12 if (error) throw new Error(error); 27 if (error) throw new Error(error);
13 - }); 28 +
29 + console.log(body);
30 + body = JSON.parse(body);
31 + console.log(body);
32 +});
33 +
14 34
15 35
...\ No newline at end of file ...\ No newline at end of file
......