mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Fixed urllib3.exceptions.NewConnectionError #173
This commit is contained in:
parent
bb2ace44d2
commit
32ef50708a
2 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
4.8.9 - 06/06/2023
|
||||||
|
Fixed
|
||||||
|
- urllib3.exceptions.NewConnectionError (Thanks to rizitis) #173
|
||||||
|
|
||||||
4.8.8 - 29/05/2023
|
4.8.8 - 29/05/2023
|
||||||
Updated:
|
Updated:
|
||||||
- France manpage
|
- France manpage
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
import requests
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from urllib3 import PoolManager, ProxyManager, make_headers
|
from urllib3 import PoolManager, ProxyManager, make_headers
|
||||||
|
@ -90,6 +91,7 @@ class CheckUpdates(Configs):
|
||||||
|
|
||||||
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
|
def compare_the_changelogs(self, local_chg_txt: Path, repo_chg_txt: str) -> bool:
|
||||||
local_size: int = 0
|
local_size: int = 0
|
||||||
|
repo_size: int = 0
|
||||||
|
|
||||||
if self.proxy_address.startswith('http'):
|
if self.proxy_address.startswith('http'):
|
||||||
self.set_http_proxy_server()
|
self.set_http_proxy_server()
|
||||||
|
@ -98,13 +100,17 @@ class CheckUpdates(Configs):
|
||||||
self.set_socks_proxy_server()
|
self.set_socks_proxy_server()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
requests.get(repo_chg_txt, timeout=2)
|
||||||
repo = self.http.request('GET', repo_chg_txt)
|
repo = self.http.request('GET', repo_chg_txt)
|
||||||
if local_chg_txt.is_file():
|
if local_chg_txt.is_file():
|
||||||
local_size: int = int(os.stat(local_chg_txt).st_size)
|
local_size: int = int(os.stat(local_chg_txt).st_size)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
except requests.exceptions.RequestException:
|
||||||
repo_size: int = int(repo.headers['Content-Length'])
|
print(f'\n\n{self.endc}{self.prog_name}: {self.bred}Error:{self.endc} '
|
||||||
|
f'Failed to connect to {repo_chg_txt}\n')
|
||||||
|
else:
|
||||||
|
repo_size: int = int(repo.headers['Content-Length'])
|
||||||
|
|
||||||
logger = logging.getLogger(LoggingConfig.date_time)
|
logger = logging.getLogger(LoggingConfig.date_time)
|
||||||
logger.info(f'{self.__class__.__name__}: '
|
logger.info(f'{self.__class__.__name__}: '
|
||||||
|
|
Loading…
Reference in a new issue