Updated for return size

This commit is contained in:
Dimitris Zlatanidis 2023-07-04 22:09:39 +03:00
parent 1fce3598f6
commit 52264b66f0
2 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,9 @@
## slpkg - ChangeLog
### 4.9.2 - 04/07/2023
- Updated:
* Check updates function for return repository size
### 4.9.1 - 28/06/2023
- Updated:
* Bullet progress bar color

View file

@ -6,7 +6,7 @@ import logging
from pathlib import Path
from multiprocessing import Process
from urllib3.exceptions import HTTPError
from urllib3 import PoolManager, ProxyManager, make_headers
from urllib3 import PoolManager, ProxyManager, make_headers, Timeout
from slpkg.configs import Configs
from slpkg.utilities import Utilities
@ -28,6 +28,8 @@ class CheckUpdates(Configs):
self.repos = Repositories()
self.compare: dict = {}
timeout = Timeout(connect=2.0, read=3.0)
self.http = PoolManager()
self.proxy_default_headers = make_headers(
proxy_basic_auth=f'{self.proxy_username}:{self.proxy_password}')
@ -105,7 +107,7 @@ class CheckUpdates(Configs):
except HTTPError:
print(f'\n\n{self.endc}{self.prog_name}: {self.bred}Error:{self.endc} '
f'Failed to connect to {repo_chg_txt}\n')
return False
repo_size: int = 0
else:
repo_size: int = int(repo.headers['Content-Length'])