Covid19 RapidAPI

"""
Requests is a HTTP library for the Python programming language. 
The goal of the project is to make HTTP requests simpler and more human-friendly. 
"""
import requests

"""
RapidAPI is the world's largest API Marketplace. 
Developers use Rapid API to discover and connect to thousands of APIs. 
"""
url = "https://corona-virus-world-and-india-data.p.rapidapi.com/api"
headers = {
    'x-rapidapi-key': "dec069b877msh0d9d0827664078cp1a18fajsn2afac35ae063",
    'x-rapidapi-host': "corona-virus-world-and-india-data.p.rapidapi.com"
}

# Request Covid Data
response = requests.request("GET", url, headers=headers)
# print(response.text)  # uncomment this line to see raw data

# This code looks for "world data"
print("World Totals")
world = response.json().get('world_total')  # turn response to json() so we can extract "world_total"
for key, value in world.items():  # this finds key, value pairs in country
    print(key, value)

print()

# This code looks for USA in "countries_stats"
print("Country Totals")
countries = response.json().get('countries_stat')
for country in countries:  # countries is a list
    if country["country_name"] == "USA":  # this filters for USA
        for key, value in country.items():  # this finds key, value pairs in country
            print(key, value)
World Totals
total_cases 509,268,964
new_cases 204,268
total_deaths 6,242,509
new_deaths 630
total_recovered 461,827,849
active_cases 41,198,606
serious_critical 42,510
total_cases_per_1m_population 65,334
deaths_per_1m_population 800.9
statistic_taken_at 2022-04-24 11:18:01

Country Totals
country_name USA
cases 82,649,779
deaths 1,018,316
region 
total_recovered 80,434,925
new_deaths 0
new_cases 0
serious_critical 1,465
active_cases 1,196,538
total_cases_per_1m_population 247,080
deaths_per_1m_population 3,044
total_tests 1,000,275,726
tests_per_1m_population 2,990,303

Spotify API

import requests

url = "https://spotify23.p.rapidapi.com/search/"

querystring = {"q":"Harry Styles","type":"artists","offset":"0","limit":"10","numberOfTopResults":"5"}

headers = {
	"X-RapidAPI-Key": "ec628c3848mshc2f96fd1e664c35p194b32jsna5ebcbef62b6",
	"X-RapidAPI-Host": "spotify23.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
{"query":"Harry+Styles","artists":{"totalCount":51,"items":[{"data":{"uri":"spotify:artist:6KImCVD70vtIoJWnq6nGn3","profile":{"name":"Harry Styles"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab6761610000e5ebf7db7c8ede90a019c54590bb","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab6761610000f178f7db7c8ede90a019c54590bb","width":160,"height":160}]}}}},{"data":{"uri":"spotify:artist:6wVLKQ3w2gCn11a0NQAkX0","profile":{"name":"Harry Younger Styles"},"visuals":{"avatarImage":null}}},{"data":{"uri":"spotify:artist:4AK6F7OLvEQ5QYCBNiQWHq","profile":{"name":"One Direction"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/289c7f686f5b78ceeb224453cf9a15697a678a79","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/6c89c662ad0ab75bc2af9a3ae2b16f811daced50","width":64,"height":64}]}}}},{"data":{"uri":"spotify:artist:6rq7VcWeCTjiBIIuGt0D96","profile":{"name":"Harry Stone"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab6761610000e5ebb6f491a3465a8408d9062cf0","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab6761610000f178b6f491a3465a8408d9062cf0","width":160,"height":160}]}}}},{"data":{"uri":"spotify:artist:7mOjyS2iRyUA5jGuoUzEhv","profile":{"name":"styles benin harry"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab67616d0000b27398a414cadc31f38fb767f147","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab67616d0000485198a414cadc31f38fb767f147","width":64,"height":64}]}}}},{"data":{"uri":"spotify:artist:2IrrH2ytG96HCP9dnM6mGr","profile":{"name":"Twan Ray"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab6761610000e5eb76414483e902603927037c8d","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab6761610000f17876414483e902603927037c8d","width":160,"height":160}]}}}},{"data":{"uri":"spotify:artist:2tCELGtX6ikbBFQomLSCRp","profile":{"name":"Harry Stockwell"},"visuals":{"avatarImage":null}}},{"data":{"uri":"spotify:artist:6CbmeywK3diNOrfk5yxr2d","profile":{"name":"STYLES HARRY EDWARD"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab67616d0000b27306b1f9b270b94fb192cfb449","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab67616d0000485106b1f9b270b94fb192cfb449","width":64,"height":64}]}}}},{"data":{"uri":"spotify:artist:72fQWyXObQBgUIUejMo6js","profile":{"name":"Molotov Cocktail Piano"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab6761610000e5eb5a9d38bfc76db9ba482d635f","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab6761610000f1785a9d38bfc76db9ba482d635f","width":160,"height":160}]}}}},{"data":{"uri":"spotify:artist:1KDOjuXZPd8XA3YBakakMb","profile":{"name":"Harry Shotta"},"visuals":{"avatarImage":{"sources":[{"url":"https:\/\/i.scdn.co\/image\/ab6761610000e5eb1eaf3ed16e9ac9e629844890","width":640,"height":640},{"url":"https:\/\/i.scdn.co\/image\/ab6761610000f1781eaf3ed16e9ac9e629844890","width":160,"height":160}]}}}}],"pagingInfo":{"nextOffset":10,"limit":10}}}
import requests

url = "https://spotify23.p.rapidapi.com/albums/"

querystring = {"ids":"Harry's House"}

headers = {
	"X-RapidAPI-Key": "ec628c3848mshc2f96fd1e664c35p194b32jsna5ebcbef62b6",
	"X-RapidAPI-Host": "spotify23.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
{"error":{"status":400,"message":"invalid id"}}
fetch("https://type.fit/api/quotes")
  .then(function(response) {
    return response.json();
  })
  .then(function(data) {
    console.log(data);
  });
  
const settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://type.fit/api/quotes",
    "method": "GET"
}
  
$.ajax(settings).done(function (response) {
    const data = JSON.parse(response);
    console.log(data);
});
  Input In [3]
    then(function(response) {
    ^
IndentationError: unexpected indent
const options = {
	method: 'POST',
	headers: {
		'content-type': 'application/json',
		'X-RapidAPI-Key': 'ec628c3848mshc2f96fd1e664c35p194b32jsna5ebcbef62b6',
		'X-RapidAPI-Host': 'motivational-quotes1.p.rapidapi.com'
	},
	body: '{"key1":"value","key2":"value"}'
};

fetch('https://motivational-quotes1.p.rapidapi.com/motivation', options)
	.then(response => response.json())
	.then(response => console.log(response))
	.catch(err => console.error(err));

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
  Input In [6]
    const options = {
          ^
SyntaxError: invalid syntax