Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
ip = requests.get("https://api.ipify.org").text
if ip != last_ip:
response = requests.post("https://proxy.webshare.io/api/proxy/config/",
json={"authorized_ips": [ip]},
headers={"Authorization": apikey})
json={"authorized_ips": [ip]},
headers={"Authorization": apikey})
if response.status_code == 200:
if response.json()["authorized_ips"][0] == ip:
logging.warning("Successfully updated ip to: " + ip)
else:
logging.warning("Ip didn't update to " + ip + " for some reason")
logging.warning("Ip didn't update to " + ip +
" for some reason")
else:
logging.warning("Received " + response.status_code + " error while updating ip to: " + ip)
logging.warning("Received " + response.status_code +
" error while updating ip to: " + ip)
last_ip = ip
time.sleep(delay)
time.sleep(delay)