Testing out Rapid API
Gas Prices Throughout the World
import requests
url = "https://gas-price.p.rapidapi.com/europeanCountries"
headers = {
"X-RapidAPI-Key": "093c731fb9mshd2b4db3a5a833acp172c94jsn194a4fa97d9b",
"X-RapidAPI-Host": "gas-price.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
import requests
url = "https://gas-price.p.rapidapi.com/europeanCountries"
headers = {
"X-RapidAPI-Key": "093c731fb9mshd2b4db3a5a833acp172c94jsn194a4fa97d9b",
"X-RapidAPI-Host": "gas-price.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers)
all = response.json()
for x in all:
for key, value in x.items():
if (key == "currency"):
print("Currency:", value)
if (key == "lpg"):
print("Liquified Petroleum Gas:", value)
if (key == "diesel"):
print ("Diesel:", value)
if (key == "gasoline"):
print ("Gasoline:", value)
if (key == "country"):
print ("Country:", value)