Basic GET Request against the CWG Locations Endpoint
import requests
url = "http://api.metdesk.com/get/metdesk/cwg/v1/locations"
headers = {
'Authorization': '<insert your API Key>'
}
response = requests.request("GET", url, headers=headers)
print(response.text)
Example 2
Another GET Request against the CWG API but using the Forecasts Endpoint
import requests
url = "http://api.metdesk.com/get/metdesk/cwg/v1/forecasts"
parameters = {
'model' : 'gfsop',
'issue' : '2020-12-30T00:00:00Z',
'start_dtg' : '2020-12-31T00:00:00Z',
'end_dtg' : '2021-01-01T00:00:00Z',
'element' : 'tt',
'location' : 'GB'
}
headers = {
'Authorization': '<insert your API Key>'
}
response = requests.request("GET", url, headers=headers, params=parameters)
print(response.text)