Query the Accuweather API

Authentication

Start by getting a valid API key from Accuweather: https://developer.accuweather.com/user/register

Forecasts

The below query is the simplest possible forecast, performing a daily forecast for 1 day ahead, for the zip code defined in a spreadsheet cell, with the API key created above as a query parameter.

import requests 

# Enter your API key to fix 
response = requests.get("https://dataservice.accuweather.com/forecasts/v1/daily/1day/" + str(c(1,3)) + "?apikey=<api_key_here>")

# Filter the data we want 
date = response.json()['Headline']['EffectiveDate']
forecast = response.json()['Headline']['Text']
severity = response.json()['Headline']['Severity']
category = response.json()['Headline']['Category']

# Return data to the sheet 
[[date, forecast, severity, category]]

The above code returns the following:

Output from Accuweather

Sample sheet: https://app.quadratichq.com/file/5e1b6813-934b-4963-ae87-9a70b513d4fc

More endpoints: https://developer.accuweather.com/apis

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The infinite canvas spreadsheet with code.

Try it now