Spaces:
Sleeping
Sleeping
Fix: do nothing inside retreve_proxy
Browse files
utils.py
CHANGED
@@ -26,25 +26,27 @@ def retrieve_proxy(proxy=None):
|
|
26 |
1, 如果proxy = NONE,设置环境变量,并返回最新设置的代理
|
27 |
2,如果proxy != NONE,更新当前的代理配置,但是不更新环境变量
|
28 |
"""
|
29 |
-
|
30 |
-
if proxy is not None:
|
31 |
-
old_var = os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"]
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
|
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
|
48 |
|
49 |
|
50 |
@retry(wait=wait_random_exponential(multiplier=1, max=40), stop=stop_after_attempt(10))
|
|
|
26 |
1, 如果proxy = NONE,设置环境变量,并返回最新设置的代理
|
27 |
2,如果proxy != NONE,更新当前的代理配置,但是不更新环境变量
|
28 |
"""
|
29 |
+
pass
|
|
|
|
|
30 |
|
31 |
+
# global http_proxy, https_proxy
|
32 |
+
# if proxy is not None:
|
33 |
+
# old_var = os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"]
|
34 |
|
35 |
+
# os.environ["HTTP_PROXY"] = proxy
|
36 |
+
# os.environ["HTTPS_PROXY"] = proxy
|
37 |
+
# yield proxy, proxy
|
38 |
|
39 |
+
# # return old proxy
|
40 |
+
# os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
|
41 |
+
|
42 |
+
# else:
|
43 |
+
# old_var = os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"]
|
44 |
+
# os.environ["HTTP_PROXY"] = http_proxy
|
45 |
+
# os.environ["HTTPS_PROXY"] = https_proxy
|
46 |
+
# yield http_proxy, https_proxy # return new proxy
|
47 |
|
48 |
+
# # return old proxy
|
49 |
+
# os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
|
50 |
|
51 |
|
52 |
@retry(wait=wait_random_exponential(multiplier=1, max=40), stop=stop_after_attempt(10))
|