Spaces:
Build error
Build error
Commit
·
e2030ec
1
Parent(s):
3a91238
Delete check_proxy.py
Browse files- check_proxy.py +0 -22
check_proxy.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
|
2 |
-
def check_proxy(proxies):
|
3 |
-
import requests
|
4 |
-
proxies_https = proxies['https'] if proxies is not None else '无'
|
5 |
-
try:
|
6 |
-
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
7 |
-
data = response.json()
|
8 |
-
print(f'查询代理的地理位置,返回的结果是{data}')
|
9 |
-
country = data['country_name']
|
10 |
-
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
11 |
-
print(result)
|
12 |
-
return result
|
13 |
-
except:
|
14 |
-
result = f"代理配置 {proxies_https}, 代理所在地查询超时,代理可能无效"
|
15 |
-
print(result)
|
16 |
-
return result
|
17 |
-
|
18 |
-
|
19 |
-
if __name__ == '__main__':
|
20 |
-
try: from config_private import proxies # 放自己的秘密如API和代理网址 os.path.exists('config_private.py')
|
21 |
-
except: from config import proxies
|
22 |
-
check_proxy(proxies)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|