def add_role_by_email(email, role_id):
    try:
        req = post_request(f'/users-by-email/{email}/roles/{role_id}',
                           payload=None)
    except HTTPError as e:
        if e.response.status_code == 500:
            raise DataRequestException(500, {
                "errors": ["Failed to grant role by email, please wait a "
                           "minute and try again."]
            })
    return req
def post_outage(report_id, outage_dict):
    outage_id = post_request(f'/reports/{report_id}/outages', outage_dict)
    return outage_id
def post_metadata(report_dict):
    success = post_request('/reports/', report_dict)
    return success
Example #4
0
def post_values(uuid, values, json=True):
    req = post_request(f'/forecasts/single/{uuid}/values', values, json)
    return req
def add_object(permission_id, object_id):
    req = post_request(f'/permissions/{permission_id}/objects/{object_id}',
                       payload=None)
    return req
def post_metadata(permission_dict):
    req = post_request('/permissions/', permission_dict)
    return req
Example #7
0
def update(aggregate_id, updates):
    req = post_request(f'/aggregates/{aggregate_id}/metadata',
                       updates,
                       json=True)
    return req
Example #8
0
def update(observation_id, updates):
    req = post_request(f'/observations/{observation_id}/metadata', updates)
    return req
def update(forecast_id, updates):
    req = post_request(f'/forecasts/single/{forecast_id}/metadata', updates)
    return req
def add_role(user_id, role_id):
    req = post_request(f'/users/{user_id}/roles/{role_id}', payload=None)
    return req
def post_values(uuid, values, json=True):
    req = post_request(f'/observations/{uuid}/values', values, json)
    return req
def post_metadata(obs_dict):
    req = post_request('/observations/', obs_dict)
    return req
Example #13
0
def update(site_id, updates):
    req = post_request(f'/sites/{site_id}', updates)
    return req
Example #14
0
def post_metadata(forecast_dict):
    req = post_request('/forecasts/cdf/', forecast_dict)
    return req
Example #15
0
def post_metadata(aggregate_dict):
    req = post_request('/aggregates/', aggregate_dict, json=True)
    return req
def post_metadata(site_dict):
    r = post_request('/sites/', site_dict, json=True)
    return r
def update(forecast_id, updates):
    req = post_request(f'/forecasts/cdf/{forecast_id}', updates)
    return req