This repository was archived by the owner on Feb 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Expand file tree Collapse file tree 3 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 11
11
runs-on : ubuntu-latest
12
12
strategy :
13
13
matrix :
14
- python-version : [3.8, 3. 9]
14
+ python-version : [3.9]
15
15
16
16
steps :
17
17
- uses : actions/checkout@v2
Original file line number Diff line number Diff line change 1
- VERSION = '0.2.0 '
1
+ VERSION = '0.2.1 '
Original file line number Diff line number Diff line change @@ -16,25 +16,32 @@ class Repo:
16
16
repo : str
17
17
18
18
19
- def register_proxy (proxy : dict , auth : dict = None ):
19
+ def register_proxy (proxy : str , auth : dict = None ):
20
+ """Build up a https proxy dict of `request` format
21
+
22
+ Args:
23
+ proxy (str): proxy url, socks5 supoorted
24
+ auth (dict, optional): auth dict. Needs `username` and `password` field. Defaults to None.
25
+
26
+ Returns:
27
+ dict: `{'https': proxy_with_auth}`
28
+ """
20
29
global PROXY
21
30
if auth is None :
22
- PROXY = proxy . copy ()
23
- return proxy
31
+ PROXY = { 'https' : proxy }
32
+ return PROXY . copy ()
24
33
25
34
assert 'username' in auth
26
35
assert 'password' in auth
27
36
from urllib .parse import urlsplit
28
- PROXY = {}
29
37
30
- for k in proxy :
31
- p = urlsplit (proxy [k ])
32
- assert p .hostname
33
- url = f"{ p .scheme } ://{ auth ['username' ]} :{ auth ['password' ]} @{ p .hostname } "
34
- if p .port : url += f":{ p .port } "
35
- PROXY [k ] = url
38
+ p = urlsplit (proxy )
39
+ assert p .hostname
40
+ url = f"{ p .scheme } ://{ auth ['username' ]} :{ auth ['password' ]} @{ p .hostname } "
41
+ if p .port : url += f":{ p .port } "
42
+ PROXY = {'https' : url }
36
43
37
- return PROXY
44
+ return PROXY . copy ()
38
45
39
46
40
47
class GhRelease (Release ):
You can’t perform that action at this time.
0 commit comments