def send_requests():
    request_list = [
        api.offer_open(renderer, guid, engagement, email=email),
        api.login(advisor,
                  username,
                  password,
                  aid,
                  cookie_id=cookie_id_new,
                  email=email),
        api.browse(advisor,
                   username,
                   password,
                   aid,
                   sku,
                   cookie_id=cookie_id_new),
        api.cart_add(advisor,
                     username,
                     password,
                     aid,
                     sku,
                     cookie_id=cookie_id_new),
        api.buy(advisor, username, password, aid, sku,
                cookie_id=cookie_id_new),
        api.login(advisor,
                  username,
                  password,
                  aid,
                  cookie_id=cookie_id_new_2,
                  email=email),
        api.browse(advisor,
                   username,
                   password,
                   aid,
                   sku,
                   cookie_id=cookie_id_new_2),
        api.cart_add(advisor,
                     username,
                     password,
                     aid,
                     sku,
                     cookie_id=cookie_id_new_2),
        api.buy(advisor,
                username,
                password,
                aid,
                sku,
                cookie_id=cookie_id_new_2)
    ]

    for request in request_list:
        requests.get(request).raise_for_status()
예제 #2
0
def send_requests():
    # time stamp format "2016/09/07" || "YYYY/MM/DD"
    timestamp_with_delta = datetime.now() - timedelta(3)  # deducts 3 days from timestamp
    three_days_past = timestamp_with_delta.strftime("%Y-%m-%d")  # formats timestamp properly

    request_list = [
        api.offer_open(renderer, guid, engagement, email=email, position=1, timestamp=three_days_past),
        api.offer_open(renderer, guid, engagement, email=email, position=2, timestamp=three_days_past),
        api.offer_open(renderer, guid, engagement, email=email, position=3, timestamp=three_days_past),
        api.offer_open(renderer, guid, engagement, email=email, position=4, timestamp=three_days_past),
        api.offer_click(click, guid, engagement, email=email, position=1, timestamp=three_days_past)
    ]

    for request in request_list:
        response = requests.get(request)
        if not response.raise_for_status():
            if "cbtt=" in response.url:
                nonsense, cbtt = response.url.split("cbtt=")

    request_list_cbtt = [
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id, cbtt=cbtt, timestamp=three_days_past),
        api.login(advisor, username, password, aid, cookie_id=cookie_id, email=email),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.cart_add(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.buy(advisor, username, password, aid, sku, cookie_id=cookie_id)
    ]

    for request in request_list_cbtt:
        requests.get(request).raise_for_status()
예제 #3
0
def send_requests():
    # time stamp format "2016/09/07" || "YYYY/MM/DD"
    timestamp_with_delta = datetime.now() - timedelta(
        3)  # deducts 3 days from timestamp
    three_days_past = timestamp_with_delta.strftime(
        "%Y-%m-%d")  # formats timestamp properly

    request_list = [
        api.offer_open(renderer,
                       guid,
                       engagement,
                       email=email,
                       timestamp=three_days_past),
        api.login(advisor,
                  username,
                  password,
                  aid,
                  cookie_id=cookie_id,
                  email=email),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.cart_add(advisor,
                     username,
                     password,
                     aid,
                     sku,
                     cookie_id=cookie_id),
        api.buy(advisor, username, password, aid, sku, cookie_id=cookie_id)
    ]

    for request in request_list:
        requests.get(request).raise_for_status()
예제 #4
0
def send_requests():
    request_list = [
        api.login(advisor, username, password, aid, cookie_id=cookie_id, email=email),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.cart_add(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.buy(advisor, username, password, aid, sku, cookie_id=cookie_id)
    ]

    for request in request_list:
        requests.get(request).raise_for_status()