我试图在python中构建一个基本的代理检查器实用程序。这是我现在拥有的:
import requests
from bs4 import BeautifulSoup
currentip=""
originalip=""
isProxied=False
proxies=["104.236.54.196:8080", "187.62.191.3:61456", "138.204.179.162:44088", "91.216.66.70:32306"]
proxy_count = len(proxies)
url = "https://www.ipchicken.com/"
r = requests.get(url)
def statement():
global currentip
global originalip
print("Current ip is: "+currentip)
print("Your true ip is: "+originalip)
def main(req):
global currentip
soup = BeautifulSoup(req.content, "html.parser")
html = soup.html
body = html.body
font = body.find_all('font')
ip_container = font[0].b
ip = ip_conta