镜像自地址
https://github.com/binary-husky/gpt_academic.git
已同步 2025-12-06 06:26:47 +00:00
add proxy debug funtion
这个提交包含在:
25
check_proxy.py
普通文件
25
check_proxy.py
普通文件
@@ -0,0 +1,25 @@
|
||||
|
||||
"""
|
||||
我:用python的requests库查询本机ip地址所在地
|
||||
ChatGPT:
|
||||
"""
|
||||
def check_proxy(proxies):
|
||||
import requests
|
||||
try:
|
||||
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
||||
data = response.json()
|
||||
country = data['country_name']
|
||||
# city = data['city']
|
||||
proxies_https = proxies['https'] if proxies is not None else '无'
|
||||
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
||||
print(result)
|
||||
return result
|
||||
except:
|
||||
result = f"代理配置 {proxies_https}, 代理所在地查询超时,代理可能无效"
|
||||
print(result)
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from config import proxies
|
||||
check_proxy(proxies)
|
||||
在新工单中引用
屏蔽一个用户