mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[flatpak] fix log
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import yaml
|
import yaml
|
||||||
@@ -17,7 +18,7 @@ class HttpClient:
|
|||||||
self.sleep = sleep
|
self.sleep = sleep
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
|
|
||||||
def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False, single_call: bool = False, session: bool = True) -> requests.Response:
|
def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False, single_call: bool = False, session: bool = True) -> Optional[requests.Response]:
|
||||||
cur_attempts = 1
|
cur_attempts = 1
|
||||||
|
|
||||||
while cur_attempts <= self.max_attempts:
|
while cur_attempts <= self.max_attempts:
|
||||||
@@ -44,7 +45,7 @@ class HttpClient:
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
if single_call:
|
if single_call:
|
||||||
return
|
return res
|
||||||
|
|
||||||
if self.sleep > 0:
|
if self.sleep > 0:
|
||||||
time.sleep(self.sleep)
|
time.sleep(self.sleep)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class FlatpakAsyncDataLoader(Thread):
|
|||||||
self.api_cache.add(self.app.id, loaded_data)
|
self.api_cache.add(self.app.id, loaded_data)
|
||||||
self.persist = self.app.supports_disk_cache()
|
self.persist = self.app.supports_disk_cache()
|
||||||
else:
|
else:
|
||||||
self.logger.warning("Could not retrieve app data for id '{}'. Server response: {}. Body: {}".format(self.app.id, res.status_code, res.content.decode()))
|
self.logger.warning("Could not retrieve app data for id '{}'. Server response: {}. Body: {}".format(self.app.id, res.status_code if res else '?', res.content.decode() if res else '?'))
|
||||||
except:
|
except:
|
||||||
self.logger.error("Could not retrieve app data for id '{}'".format(self.app.id))
|
self.logger.error("Could not retrieve app data for id '{}'".format(self.app.id))
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|||||||
Reference in New Issue
Block a user