-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Detailed report #69
Conversation
Added URL information on the report Added a short checking stats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR, overwhall, looks good to me, I left some comments and suggestions !
prioritize accessing a value from key in a dictionary with the .get()
method, this will allow you to specify a default value if the value is not present and prevent the app crashing for a KeyError exception !
Thanks for tests !
blc/__main__.py
Outdated
f"URL: {url}\n"\ | ||
f"Parent URL: {info['parent']}\n"\ | ||
f"Real URL: {info['url']}\n"\ | ||
f"Check time: {info['check_time']} seconds\n"\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to reduce the floating point to 4:
f"Check time: {info['check_time']} seconds\n"\ | |
f"Check time: {round(info['check_time'], 4)} seconds\n"\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
blc/checker.py
Outdated
@@ -101,33 +103,31 @@ def check(self, url: str) -> requests.Response: | |||
:url represent the URL to check | |||
""" | |||
# We verify the URL is already checked | |||
if url in self.checked_url: | |||
if [u for u in self.urls if self.urls[u]['result'] and url == u]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [u for u in self.urls if self.urls[u]['result'] and url == u]: | |
if url in self.urls.keys() and self.urls[url].get('result', False): |
What do you think about this instead of looping?
'url': origin_url, | ||
'result': None, | ||
'check_time': None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.update_list(response) | ||
time.sleep(self.delay) | ||
while 1: | ||
url_to_check = [u for u in self.urls if not self.urls[u]['result']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url_to_check = [u for u in self.urls if not self.urls[u]['result']] | |
url_to_check = [u for u in self.urls if not self.urls[u].get('result', False)] |
to prevent a KeyError raising here !
blc/checker.py
Outdated
if url_to_check: | ||
pass | ||
else: | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if url_to_check: | |
pass | |
else: | |
break | |
if not url_to_check: | |
break |
blc/checker.py
Outdated
else: | ||
break | ||
|
||
while (url_to_check): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while (url_to_check): | |
while url_to_check: |
Change
Linked to
Preview