diff --git a/README.md b/README.md index 72cfadd..aa2e900 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ See [here](https://github.com/coskundeniz/ad_clicker/wiki/Creating-and-running-D ## How to run +* You need to see `(env)` at the beginning of your command prompt that is showing virtual environment is activated. + ``` usage: python ad_clicker.py [-h] [-q QUERY] [-e EXCLUDES] [-t AD_VISIT_TIME] [--headless] [-p PROXY] [-pf PROXY_FILE] [--auth] [--incognito] diff --git a/utils.py b/utils.py index 4214843..30810ee 100644 --- a/utils.py +++ b/utils.py @@ -92,32 +92,39 @@ def get_location( if auth: for cycle in range(2): try: - logger.debug("Trying with ipv4.webshare.io...") - response = requests.get( - "https://ipv4.webshare.io/", proxies=proxies_header, timeout=5 - ) + response = requests.get("https://api.ipify.org", proxies=proxies_header) ip_address = response.text break except: - logger.debug("Failed with ipv4.webshare.io") - + logger.debug("Failed with api.ipify.org") try: - logger.debug("Trying with ipconfig.io...") + logger.debug("Trying with ipv4.webshare.io...") response = requests.get( - "https://ipconfig.io/json", proxies=proxies_header, timeout=5 + "https://ipv4.webshare.io/", proxies=proxies_header, timeout=5 ) - ip_address = response.json().get("ip") + ip_address = response.text break except: - logger.debug("Failed with ipconfig.io") + logger.debug("Failed with ipv4.webshare.io") - if cycle == 1: + try: + logger.debug("Trying with ipconfig.io...") + response = requests.get( + "https://ipconfig.io/json", proxies=proxies_header, timeout=5 + ) + ip_address = response.json().get("ip") break - logger.debug("Request will be resend after 60 seconds") - sleep(60) + except: + logger.debug("Failed with ipconfig.io") + + if cycle == 1: + break + + logger.debug("Request will be resend after 60 seconds") + sleep(60) else: ip_address = proxy.split(":")[0]