예제 #1
0
def put_secret(name, secret_type, fields):
    response = get_session().put(
        base_secrets_url + "/" + name,
        json={
            "name": name,
            "type": secret_type,
            "fields": parse_key_values(fields)
        },
    )
    if response.status_code != 200:
        raise get_exception(response)
    else:
        return response.json()
예제 #2
0
def create_secret(name, secret_type, fields):
    token = get_stored_token()
    response = requests.post(base_secrets_url,
                             headers={'Authorization': 'JWT ' + token},
                             json={
                                 "name": name,
                                 "type": secret_type,
                                 "fields": parse_key_values(fields)
                             },
                             )
    if response.status_code != 200:
        raise get_exception(response)
    else:
        return response.json()