Beispiel #1
0
def api__update_subscription(token, subscription_type, stripe_token):
    requests.post(config__get("COUCHDROP_WEB__API_URL") +
                  "/manage/account/subscription?token=" + token,
                  data=json.dumps({
                      "subscription_type": subscription_type,
                      "stripe_token": stripe_token,
                  }))
Beispiel #2
0
def resetpassword_confirm(code, password):
    ret = requests.post(config__get("COUCHDROP_WEB__API_URL") +
                        "/resetpassword/reset/" + code,
                        data=dict(password=password))

    if ret.status_code == 200:
        return json.loads(ret.text)
    return None
Beispiel #3
0
def request_reset_password(email_address):
    ret = requests.post(
        config__get("COUCHDROP_WEB__API_URL") + "/resetpassword/" +
        email_address, )

    if ret.status_code == 200:
        return json.loads(ret.text)
    return None
Beispiel #4
0
def register_confirm(confirm_code):
    ret = requests.post(
        config__get("COUCHDROP_WEB__API_URL") + "/register/confirm/" +
        confirm_code, )

    if ret.status_code == 200:
        return json.loads(ret.text)
    return None
Beispiel #5
0
def authenticate(username, password):
    ret = requests.post(config__get("COUCHDROP_WEB__API_URL") +
                        "/authenticate",
                        data=dict(username=username, password=password))

    if ret.status_code == 200:
        return json.loads(ret.text)["token"]
    return None
Beispiel #6
0
def api__get_storage(token):
    ret = requests.get(
        config__get("COUCHDROP_WEB__API_URL") +
        "/manage/account/storage?token=" + token, )

    ret_dict = None
    if ret.status_code == 200:
        ret_dict = json.loads(ret.text)
    return ret_dict["storage"]
Beispiel #7
0
def api__get_filelink(file_id, token):
    ret = requests.get(
        config__get("COUCHDROP_WEB__API_URL") +
        "/manage/files/%s/download?token=%s" % (file_id, token), )

    ret_dict = None
    if ret.status_code == 200:
        ret_dict = json.loads(ret.text)
    return ret_dict["url"]
Beispiel #8
0
def api__get_credentials(token):
    ret = requests.get(
        config__get("COUCHDROP_WEB__API_URL") + "/manage/credentials?token=" +
        token, )

    ret_dict = None
    if ret.status_code == 200:
        ret_dict = json.loads(ret.text)
    return ret_dict["credentials"]
Beispiel #9
0
def register(username, password, email_address, subscription_type,
             stripe_token):
    ret = requests.post(config__get("COUCHDROP_WEB__API_URL") + "/register",
                        data=dict(username=username,
                                  password=password,
                                  email_address=email_address,
                                  subscription_type=subscription_type,
                                  stripe_token=stripe_token))

    return ret.status_code == 200
Beispiel #10
0
def api__set_account(token, account):
    requests.post(config__get("COUCHDROP_WEB__API_URL") +
                  "/manage/account?token=" + token,
                  data=json.dumps(account))
Beispiel #11
0
def api__get_credentials_delete(token, username):
    requests.delete(
        config__get("COUCHDROP_API_URL") +
        "/manage/credentials/%s/delete?token=%s" % (username, token), )
Beispiel #12
0
def api__get_credentials_save(token, object):
    requests.post(config__get("COUCHDROP_WEB__API_URL") +
                  "/manage/credentials?token=" + token,
                  data=json.dumps(object))
Beispiel #13
0
def api__get_credentials_create(token):
    requests.put(
        config__get("COUCHDROP_WEB__API_URL") + "/manage/credentials?token=" +
        token, )
Beispiel #14
0
def api__delete_storage(token, id):
    requests.delete(config__get("COUCHDROP_WEB__API_URL") +
                    "/manage/account/storage?token=" + token,
                    data=json.dumps({"id": id}))
Beispiel #15
0
def api__post_storage(token, bucket):
    requests.post(config__get("COUCHDROP_WEB__API_URL") +
                  "/manage/account/storage?token=" + token,
                  data=json.dumps(bucket))
Beispiel #16
0
def api__put_storage(token):
    requests.put(
        config__get("COUCHDROP_WEB__API_URL") +
        "/manage/account/storage?token=" + token, )