My API Experience
The Weather API: By Zip Code
I found an amazing API on the RapidAPI platform that houses data for weather details and conditions by ZIP code. By changing the inputs, I can display ZIP code specific data and change the city information displayed immediately, including up-to-date temperatures and weather description.
import requests
url = "https://us-weather-by-zip-code.p.rapidapi.com/getweatherzipcode"
querystring = {"zip":"92127"}
headers = {
"X-RapidAPI-Key": "24a738dc44msh1340883298de7f6p133977jsnb8399f963780",
"X-RapidAPI-Host": "us-weather-by-zip-code.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
import requests
url = "https://us-weather-by-zip-code.p.rapidapi.com/getweatherzipcode"
querystring = {"zip":"94114"}
headers = {
"X-RapidAPI-Key": "24a738dc44msh1340883298de7f6p133977jsnb8399f963780",
"X-RapidAPI-Host": "us-weather-by-zip-code.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)