コード例 #1
0
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
コード例 #2
0
def get_zone_by_lat_lon(latitude, longitude):
    req = get_request('/climatezones/search',
                      params={
                          'latitude': latitude,
                          'longitude': longitude
                      })
    return req
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
def list_metadata():
    req = get_request('/roles/')
    return req
コード例 #8
0
def get_metadata(role_id):
    req = get_request(f'/roles/{role_id}')
    return req
コード例 #9
0
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
コード例 #10
0
def get_metadata(permission_id):
    req = get_request(f'/permissions/{permission_id}')
    return req
コード例 #11
0
def get_metadata(site_id):
    r = get_request(f'/sites/{site_id}')
    return r
コード例 #12
0
def get_values(observation_id, **kwargs):
    req = get_request(f'/observations/{observation_id}/values', **kwargs)
    return req
コード例 #13
0
def get_outages(report_id):
    outages = get_request(f'/reports/{report_id}/outages')
    return outages
コード例 #14
0
def actions_on(uuid):
    req = get_request(f'/users/actions-on/{uuid}')
    return req
コード例 #15
0
def current():
    req = get_request('/users/current')
    return req
コード例 #16
0
def get_create_permissions():
    req = get_request('/users/can-create/')
    return req
コード例 #17
0
def get_metadata(forecast_id):
    req = get_request(f'/forecasts/single/{forecast_id}/metadata')
    return req
コード例 #18
0
def list_metadata():
    reports = get_request('/reports/')
    return reports
コード例 #19
0
def recompute(report_id):
    recompute = get_request(f'/reports/{report_id}/recompute')
    return recompute
コード例 #20
0
def get_metadata(forecast_id):
    req = get_request(f'/forecasts/cdf/{forecast_id}')
    return req
コード例 #21
0
def get_metadata(report_id):
    report = get_request(f'/reports/{report_id}')
    return report
コード例 #22
0
def get_metadata(observation_id):
    req = get_request(f'/observations/{observation_id}/metadata')
    return req
コード例 #23
0
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
コード例 #24
0
def valid_times(forecast_id):
    req = get_request(f'/forecasts/single/{forecast_id}/values/timerange')
    return req
コード例 #25
0
def get_values(forecast_id, **kwargs):
    req = get_request(f'/forecasts/cdf/{forecast_id}/values', **kwargs)
    return req
コード例 #26
0
def get_metadata(aggregate_id):
    req = get_request(f'/aggregates/{aggregate_id}/metadata')
    return req
コード例 #27
0
def list_metadata():
    r = get_request('/sites/')
    return r
コード例 #28
0
def get_values(aggregate_id, **kwargs):
    req = get_request(f'/aggregates/{aggregate_id}/values', **kwargs)
    return req
コード例 #29
0
def list_metadata():
    req = get_request('/permissions/')
    return req
コード例 #30
0
def list_metadata():
    req = get_request('/aggregates/')
    return req