zhitou_trade/aaaaaaa.py

26 lines
750 B
Python
Raw Permalink Normal View History

2025-05-22 16:47:45 +08:00
import requests
import logging
def get_ip_data():
"""从API获取代理IP和端口"""
url = "http://api.tianqiip.com/getip"
params = {
"secret": "d8wqfdf0qhrnxgne", # 替换为你的提取秘钥
"num": 1,
"yys": "电信",
"type": "json",
"lb": "\n",
# "region": "1,2,3",
"port": 2,
"time": 3,
"ts": 1,
"ys": 1,
"cs": 1,
"sign": "386ff88188185bc6070ec011266745b3", # 用户签名
"mr": 1
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
if data.get("code") == 1000:
logging.info("获取代理IP成功")
return data.get("data")[0]