You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
auto/archive/check/test_proxy_ip.py

28 lines
631 B

import aiohttp
import asyncio
# 您提供的代理信息
proxy = 'http://s8P7v8:mmVgdf@45.158.197.113:8000'
async def fetch(session, url):
# 使用代理
async with session.get(url, proxy=proxy) as response:
return await response.text()
async def main():
urls = [
"https://api.ip.cc",
"https://icanhazip.com"
]
async with aiohttp.ClientSession() as session:
tasks = [fetch(session, url) for url in urls]
results = await asyncio.gather(*tasks)
for result in results:
print(result)
print()
# 运行异步主函数
asyncio.run(main())