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():
    request_list = [
        api.offer_open(renderer, guid, engagement, cookie_id=cookie_id),
        api.offer_click(click, guid, engagement, cookie_id=cookie_id, position=""),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.browse(advisor, username, password, aid, sku, cookie_id=cookie_id),
        api.cart_add(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()
def send_requests():
    request_list = [
        api.offer_open(renderer, guid, engagement, email=email, position=1),
        api.offer_open(renderer, guid, engagement, email=email, position=2),
        api.offer_open(renderer, guid, engagement, email=email, position=3),
        api.offer_open(renderer, guid, engagement, email=email, position=4),
        api.offer_click(click, guid, engagement, email=email, position=1),
    ]

    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),
        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()
def send_requests():
    # time stamp format "2016/09/07" || "YYYY/MM/DD"
    timestamp_with_delta = datetime.now() - timedelta(1)  # deducts 1 day from timestamp
    one_day_past = timestamp_with_delta.strftime("%Y-%m-%d")  # formats timestamp properly

    request_list = [
        api.offer_open(renderer, guid, engagement, email=email, timestamp=one_day_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()
예제 #5
0
def send_requests():
    request_list = [
        api.offer_open(renderer,
                       guid,
                       engagement,
                       email=email,
                       cookie_id=cookie_id),
        api.offer_click(click,
                        guid,
                        engagement,
                        email=email,
                        cookie_id=cookie_id_new),
        api.browse(advisor,
                   username,
                   password,
                   aid,
                   sku,
                   cookie_id=cookie_id_new),
        api.browse(advisor,
                   username,
                   password,
                   aid,
                   sku,
                   cookie_id=cookie_id_new),
        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.cart_add(advisor,
                     username,
                     password,
                     aid,
                     sku,
                     cookie_id=cookie_id_new),
        api.buy(advisor, username, password, aid, sku, cookie_id=cookie_id_new)
    ]

    for request in request_list:
        requests.get(request)
예제 #6
0
def get_response(renderer_url, guid_link, user_email, engagement_id,
                 position_value):
    """sends a request to the renderer for a suggestion response and
    returns the content of the response or raises an exception if the
    status code of the return is not 200/300"""

    request_url = api.offer_open(renderer_url,
                                 guid_link,
                                 engagement_id,
                                 email=user_email,
                                 position=position_value,
                                 format="sugg")

    json_handler = requests.get(
        request_url
    )  # get the specified url and store the content as a variable
    if not json_handler.raise_for_status():
        return json_handler.json()
예제 #7
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()