Eralien commited on
Commit
8c5f25c
·
1 Parent(s): 460c3f9

Fix: do nothing inside retreve_proxy

Browse files
Files changed (1) hide show
  1. utils.py +17 -15
utils.py CHANGED
@@ -26,25 +26,27 @@ def retrieve_proxy(proxy=None):
26
  1, 如果proxy = NONE,设置环境变量,并返回最新设置的代理
27
  2,如果proxy != NONE,更新当前的代理配置,但是不更新环境变量
28
  """
29
- global http_proxy, https_proxy
30
- if proxy is not None:
31
- old_var = os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"]
32
 
33
- os.environ["HTTP_PROXY"] = proxy
34
- os.environ["HTTPS_PROXY"] = proxy
35
- yield proxy, proxy
36
 
37
- # return old proxy
38
- os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
 
39
 
40
- else:
41
- old_var = os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"]
42
- os.environ["HTTP_PROXY"] = http_proxy
43
- os.environ["HTTPS_PROXY"] = https_proxy
44
- yield http_proxy, https_proxy # return new proxy
 
 
 
45
 
46
- # return old proxy
47
- os.environ["HTTP_PROXY"], os.environ["HTTPS_PROXY"] = old_var
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))