Beispiel #1
0
def amazon(
    no_image,
    headless,
    test,
    delay,
    checkshipping,
    detailed,
    used,
    random_delay,
    single_shot,
    no_screenshots,
):
    if no_image:
        selenium_utils.no_amazon_image()
    else:
        selenium_utils.yes_amazon_image()

    amzn_obj = Amazon(
        headless=headless,
        notification_handler=notification_handler,
        checkshipping=checkshipping,
        random_delay=random_delay,
        detailed=detailed,
        used=used,
        single_shot=single_shot,
        no_screenshots=no_screenshots,
    )
    amzn_obj.run(delay=delay, test=test)
Beispiel #2
0
def amazon(
    no_image,
    headless,
    test,
    delay,
    checkshipping,
    detailed,
    used,
    single_shot,
    no_screenshots,
    disable_presence,
    disable_sound,
    slow_mode,
    p,
    log_stock_check,
    shipping_bypass,
    clean_profile,
    clean_credentials,
    alt_offers,
    captcha_wait,
):
    notification_handler.sound_enabled = not disable_sound
    if not notification_handler.sound_enabled:
        log.info("Local sounds have been disabled.")

    if clean_profile and os.path.exists(global_config.get_browser_profile_path()):
        log.info(
            f"Removing existing profile at '{global_config.get_browser_profile_path()}'"
        )
        profile_size = get_folder_size(global_config.get_browser_profile_path())
        shutil.rmtree(global_config.get_browser_profile_path())
        log.info(f"Freed {profile_size}")

    if clean_credentials and os.path.exists(AMAZON_CREDENTIAL_FILE):
        log.info(f"Removing existing Amazon credentials from {AMAZON_CREDENTIAL_FILE}")
        os.remove(AMAZON_CREDENTIAL_FILE)

    amzn_obj = Amazon(
        headless=headless,
        notification_handler=notification_handler,
        checkshipping=checkshipping,
        detailed=detailed,
        used=used,
        single_shot=single_shot,
        no_screenshots=no_screenshots,
        disable_presence=disable_presence,
        slow_mode=slow_mode,
        no_image=no_image,
        encryption_pass=p,
        log_stock_check=log_stock_check,
        shipping_bypass=shipping_bypass,
        alt_offers=alt_offers,
        wait_on_captcha_fail=captcha_wait,
    )
    try:
        amzn_obj.run(delay=delay, test=test)
    except RuntimeError:
        del amzn_obj
        log.error("Exiting Program...")
        time.sleep(5)
Beispiel #3
0
def amazon(
    amazon_email,
    amazon_password,
    amazon_item_url,
    amazon_price_limit,
    no_image,
    headless,
):
    os.environ.setdefault("amazon_email", amazon_email)
    os.environ.setdefault("amazon_password", amazon_password)
    os.environ.setdefault("amazon_item_url", amazon_item_url)
    os.environ.setdefault("amazon_price_limit", str(amazon_price_limit))

    if no_image:
        selenium_utils.no_amazon_image()

    amzn_obj = Amazon(
        username=amazon_email,
        password=amazon_password,
        headless=headless,
        item_url=amazon_item_url,
    )
    amzn_obj.run_item(item_url=amazon_item_url, price_limit=amazon_price_limit)

    if no_image:
        selenium_utils.no_amazon_image()
Beispiel #4
0
def amazon(no_image, headless, test):
    if no_image:
        selenium_utils.no_amazon_image()
    else:
        selenium_utils.yes_amazon_image()

    amzn_obj = Amazon(headless=headless)
    amzn_obj.run_item(test=test)
Beispiel #5
0
def amazon(no_image, headless, test, delay):
    if no_image:
        selenium_utils.no_amazon_image()
    else:
        selenium_utils.yes_amazon_image()

    amzn_obj = Amazon(headless=headless,
                      notification_handler=notification_handler)
    amzn_obj.run_item(delay=delay, test=test)
Beispiel #6
0
def amazon(amazon_email, amazon_password, amazon_item_url, amazon_price_limit):
    os.environ.setdefault('amazon_email', amazon_email)
    os.environ.setdefault('amazon_password', amazon_password)
    os.environ.setdefault('amazon_item_url', amazon_item_url)
    os.environ.setdefault('amazon_price_limit', str(amazon_price_limit))

    amzn_obj = Amazon(username=amazon_email,
                      password=amazon_password,
                      debug=True)
    amzn_obj.run_item(item_url=amazon_item_url, price_limit=amazon_price_limit)
Beispiel #7
0
def amazon(no_image, headless, test, config_file):
    if no_image:
        selenium_utils.no_amazon_image()
    else:
        selenium_utils.yes_amazon_image()

    amzn_obj = Amazon(headless=headless,
                      notification_handler=notification_handler,
                      config_file=config_file)
    amzn_obj.run_item(test=test)
Beispiel #8
0
def amazon(no_image, headless, test, delay, checkshipping, detailed):
    if no_image:
        selenium_utils.no_amazon_image()
    else:
        selenium_utils.yes_amazon_image()

    amzn_obj = Amazon(
        headless=headless,
        notification_handler=notification_handler,
        checkshipping=checkshipping,
        detailed=detailed,
    )
    amzn_obj.run_item(delay=delay, test=test)
Beispiel #9
0
def amazon(amazon_email, amazon_password, amazon_item_url, amazon_price_limit,
           no_image):
    os.environ.setdefault("amazon_email", amazon_email)
    os.environ.setdefault("amazon_password", amazon_password)
    os.environ.setdefault("amazon_item_url", amazon_item_url)
    os.environ.setdefault("amazon_price_limit", str(amazon_price_limit))

    if (no_image):
        selenium_utils.no_amazon_image()

    amzn_obj = Amazon(username=amazon_email,
                      password=amazon_password,
                      debug=True)
    amzn_obj.run_item(item_url=amazon_item_url, price_limit=amazon_price_limit)
Beispiel #10
0
def amazon(no_image, headless, test, delay, checkshipping, detailed, used,
           single_shot, no_screenshots, disable_presence, disable_sound,
           slow_mode, p, log_stock_check, shipping_bypass, clean_profile,
           clean_credentials, alt_offers):
    # notification_handler.sound_enabled = not disable_sound
    # if not notification_handler.sound_enabled:
    #     log.info("Local sounds have been disabled.")

    if clean_profile and os.path.exists(
            global_config.get_browser_profile_path()):
        log.info(
            f"Removing existing profile at '{global_config.get_browser_profile_path()}'"
        )
        profile_size = get_folder_size(
            global_config.get_browser_profile_path())
        shutil.rmtree(global_config.get_browser_profile_path())
        log.info(f"Freed {profile_size}")

    if clean_credentials and os.path.exists(AMAZON_CREDENTIAL_FILE):
        log.info(
            f"Removing existing Amazon credentials from {AMAZON_CREDENTIAL_FILE}"
        )
        os.remove(AMAZON_CREDENTIAL_FILE)

    amzn_obj = Amazon(
        headless=headless,
        # notification_handler=notification_handler,
        checkshipping=checkshipping,
        detailed=detailed,
        used=used,
        single_shot=single_shot,
        no_screenshots=no_screenshots,
        disable_presence=disable_presence,
        slow_mode=slow_mode,
        no_image=no_image,
        encryption_pass=p,
        log_stock_check=log_stock_check,
        shipping_bypass=shipping_bypass,
        alt_offers=alt_offers)
    ES_CONTINUOUS = 0x80000000
    ES_SYSTEM_REQUIRED = 0x00000001
    ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS
                                                   | ES_SYSTEM_REQUIRED)
    try:
        amzn_obj.handler(delay=delay, test=test)
    except RuntimeError:
        del amzn_obj
        log.error("Exiting Program...")
        time.sleep(5)
Beispiel #11
0
def amazon(
    no_image,
    headless,
    test,
    delay,
    checkshipping,
    detailed,
    used,
    single_shot,
    no_screenshots,
    disable_presence,
    disable_sound,
    slow_mode,
    p,
    log_stock_check,
    shipping_bypass,
):

    notification_handler.sound_enabled = not disable_sound
    if not notification_handler.sound_enabled:
        log.info("Local sounds have been disabled.")

    amzn_obj = Amazon(
        headless=headless,
        notification_handler=notification_handler,
        checkshipping=checkshipping,
        detailed=detailed,
        used=used,
        single_shot=single_shot,
        no_screenshots=no_screenshots,
        disable_presence=disable_presence,
        slow_mode=slow_mode,
        encryption_pass=p,
        no_image=no_image,
        log_stock_check=log_stock_check,
        shipping_bypass=shipping_bypass,
    )
    try:
        amzn_obj.run(delay=delay, test=test)
    except RuntimeError:
        del amzn_obj
        log.error("Exiting Program...")
        time.sleep(5)
Beispiel #12
0
 def amazon_run_item(self):
     amzn_obj = Amazon(username=self.amazon_email.value, password=self.amazon_password.value, debug=True)
     amzn_obj.run_item(item_url=self.amazon_item_url.value, price_limit=self.amazon_price_limit.value)