import requests
from requests.auth import HTTPBasicAuth
from urllib.parse import urlencode
import pandas as pd
import matplotlib.pyplot as plt
# set host, like http://localhost:8000, to where your Data Hub is running
HOST = ''
# in case of basic auth set to HTTPBasicAuth('user', 'password')
AUTH = None
q = {
'datalayer_key': 'koeppen_bw',
# Optional filters to narrow down the returned data:
#'shape_id': '',
#'shape_type': '',
#'start_date': '',
#'end_date': '',
}
d = requests.get(f"{HOST}/api/datalayers/data/?{urlencode(q)}", auth=AUTH).json()
koeppen_bw_df = pd.DataFrame(d['data'])
koeppen_bw_df['year'] = pd.to_datetime(koeppen_bw_df['year'], format="%Y")
There is no ready use snippet for API usage in R yet, though you can adapt the Python example to your R needs.