mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
Updated for pysocks import
This commit is contained in:
parent
0a4c7eb66a
commit
178e4e724c
1 changed files with 4 additions and 5 deletions
|
@ -7,11 +7,6 @@ from pathlib import Path
|
|||
from multiprocessing import Process
|
||||
from urllib3 import PoolManager, ProxyManager, make_headers
|
||||
|
||||
try: # Try to import PySocks if it's installed.
|
||||
from urllib3.contrib.socks import SOCKSProxyManager
|
||||
except (ModuleNotFoundError, ImportError):
|
||||
pass
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
|
@ -121,6 +116,10 @@ class CheckUpdates(Configs):
|
|||
self.http = ProxyManager(f'{self.proxy_address}', headers=self.proxy_default_headers)
|
||||
|
||||
def set_socks_proxy_server(self):
|
||||
try: # Try to import PySocks if it's installed.
|
||||
from urllib3.contrib.socks import SOCKSProxyManager
|
||||
except (ModuleNotFoundError, ImportError) as error:
|
||||
print(error)
|
||||
# https://urllib3.readthedocs.io/en/stable/advanced-usage.html#socks-proxies
|
||||
self.http = SOCKSProxyManager(f'{self.proxy_address}', headers=self.proxy_default_headers)
|
||||
|
||||
|
|
Loading…
Reference in a new issue