mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
improve debug messages
This commit is contained in:
@@ -4,6 +4,8 @@ from core.utils.data.state import state
|
|||||||
|
|
||||||
def scrape_rutracker(search_text):
|
def scrape_rutracker(search_text):
|
||||||
search = requests.get(f"{state.api_url}/search/{search_text}")
|
search = requests.get(f"{state.api_url}/search/{search_text}")
|
||||||
|
if state.debug:
|
||||||
|
print("Sent request to server")
|
||||||
if search:
|
if search:
|
||||||
try:
|
try:
|
||||||
return search.text
|
return search.text
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ async def init_uztracker():
|
|||||||
up = True
|
up = True
|
||||||
else:
|
else:
|
||||||
up = False
|
up = False
|
||||||
|
if state.debug:
|
||||||
print(f"Uztracker seems down, status code: {response.status_code}")
|
print(f"Uztracker seems down, status code: {response.status_code}")
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
|
if state.debug:
|
||||||
print(f"\nRequest Exception on {url_uztracker}:")
|
print(f"\nRequest Exception on {url_uztracker}:")
|
||||||
print(e)
|
print(e)
|
||||||
print("\nIs the Site down?")
|
print("\nIs the Site down?")
|
||||||
@@ -61,11 +63,12 @@ async def scrape_uztracker(search, max_results=450):
|
|||||||
break
|
break
|
||||||
|
|
||||||
except aiohttp.ClientError as e:
|
except aiohttp.ClientError as e:
|
||||||
if result:
|
if result and state.debug:
|
||||||
print(f"Failed to fetch {search_url}: {e}")
|
print(f"Failed to fetch {search_url}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
if state.debug:
|
||||||
print("Error: Uztracker down")
|
print("Error: Uztracker down")
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
@@ -85,6 +88,7 @@ def get_post_title(post_url):
|
|||||||
if state.debug:
|
if state.debug:
|
||||||
print("Program not found")
|
print("Program not found")
|
||||||
else:
|
else:
|
||||||
|
if state.debug:
|
||||||
print("Error: Uztracker down")
|
print("Error: Uztracker down")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ def settings_dialog(self):
|
|||||||
save_btn.clicked.connect(lambda: save_settings(thread_box.value(), close_settings, api_url.text(), download_path.text(), speed_limit.value()))
|
save_btn.clicked.connect(lambda: save_settings(thread_box.value(), close_settings, api_url.text(), download_path.text(), speed_limit.value()))
|
||||||
|
|
||||||
cancel_btn.clicked.connect(dialog.reject)
|
cancel_btn.clicked.connect(dialog.reject)
|
||||||
print(thread_box.value())
|
|
||||||
layout.addWidget(cancel_btn)
|
layout.addWidget(cancel_btn)
|
||||||
layout.addWidget(save_btn)
|
layout.addWidget(save_btn)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user