Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Add a new IP checking endpoint that has no request limit
Browse files Browse the repository at this point in the history
  • Loading branch information
coskundeniz committed Aug 13, 2023
1 parent 50f65b0 commit 43d9122
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
33 changes: 20 additions & 13 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit 43d9122

Please sign in to comment.