def list_metadata(site_id=None, aggregate_id=None): if site_id is not None: req = get_request(f'/sites/{site_id}/forecasts/single') elif aggregate_id is not None: req = get_request(f'/aggregates/{aggregate_id}/forecasts/single') else: req = get_request('/forecasts/single/') return req
def get_zone_by_lat_lon(latitude, longitude): req = get_request('/climatezones/search', params={ 'latitude': latitude, 'longitude': longitude }) return req
def get_email(user_id): try: req = get_request(f'/users/{user_id}/email') except HTTPError as e: if e.response.status_code == 500: raise DataRequestException(500, { "errors": ["Failed to look up user email, please wait a " "minute and try again."] }) return req
def get_metadata_by_email(email): try: req = get_request(f'/users-by-email/{email}') except HTTPError as e: if e.response.status_code == 500: raise DataRequestException(500, { "errors": ["Failed to retrieve user by email, please wait a " "minute and try again."] }) return req
def get_metadata(user_id): try: req = get_request(f'/users/{user_id}') except HTTPError as e: if e.response.status_code == 500: raise DataRequestException(500, { "errors": ["Failed to load user info, please wait a minute " "and try again."] }) return req
def actions_on_type(object_type): """Get a list of objects and actions user can perform on them. Parameters ---------- object_type: str The type of object to query for. Note that the api uses plural type notation, e.g. `observations`. Returns ------- dict Dictionary where keys are object uuids and values are a list of permitted actions. """ req = get_request(f'/users/actions-on-type/{object_type}') actions_dict = {obj['object_id']: obj['actions'] for obj in req['objects']} return actions_dict
def list_metadata(): req = get_request('/roles/') return req
def get_metadata(role_id): req = get_request(f'/roles/{role_id}') return req
def list_metadata(site_id=None): if site_id is not None: req = get_request(f'/sites/{site_id}/observations') else: req = get_request('/observations/') return req
def get_metadata(permission_id): req = get_request(f'/permissions/{permission_id}') return req
def get_metadata(site_id): r = get_request(f'/sites/{site_id}') return r
def get_values(observation_id, **kwargs): req = get_request(f'/observations/{observation_id}/values', **kwargs) return req
def get_outages(report_id): outages = get_request(f'/reports/{report_id}/outages') return outages
def actions_on(uuid): req = get_request(f'/users/actions-on/{uuid}') return req
def current(): req = get_request('/users/current') return req
def get_create_permissions(): req = get_request('/users/can-create/') return req
def get_metadata(forecast_id): req = get_request(f'/forecasts/single/{forecast_id}/metadata') return req
def list_metadata(): reports = get_request('/reports/') return reports
def recompute(report_id): recompute = get_request(f'/reports/{report_id}/recompute') return recompute
def get_metadata(forecast_id): req = get_request(f'/forecasts/cdf/{forecast_id}') return req
def get_metadata(report_id): report = get_request(f'/reports/{report_id}') return report
def get_metadata(observation_id): req = get_request(f'/observations/{observation_id}/metadata') return req
def list_metadata(site_id=None): if site_id is not None: req = get_request(f'/sites/{site_id}/forecasts/cdf') else: req = get_request('/forecasts/cdf/') return req
def valid_times(forecast_id): req = get_request(f'/forecasts/single/{forecast_id}/values/timerange') return req
def get_values(forecast_id, **kwargs): req = get_request(f'/forecasts/cdf/{forecast_id}/values', **kwargs) return req
def get_metadata(aggregate_id): req = get_request(f'/aggregates/{aggregate_id}/metadata') return req
def list_metadata(): r = get_request('/sites/') return r
def get_values(aggregate_id, **kwargs): req = get_request(f'/aggregates/{aggregate_id}/values', **kwargs) return req
def list_metadata(): req = get_request('/permissions/') return req
def list_metadata(): req = get_request('/aggregates/') return req