feat: Detailed report#69
Merged
Merged
Conversation
Added URL information on the report Added a short checking stats
Sanix-Darker
approved these changes
Sep 15, 2022
Member
Sanix-Darker
left a comment
There was a problem hiding this comment.
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 !
| f"URL: {url}\n"\ | ||
| f"Parent URL: {info['parent']}\n"\ | ||
| f"Real URL: {info['url']}\n"\ | ||
| f"Check time: {info['check_time']} seconds\n"\ |
Member
There was a problem hiding this comment.
Try to reduce the floating point to 4:
Suggested change
| f"Check time: {info['check_time']} seconds\n"\ | |
| f"Check time: {round(info['check_time'], 4)} seconds\n"\ |
| """ | ||
| # 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]: |
Member
There was a problem hiding this comment.
Suggested change
| 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 | ||
|
|
| 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']] |
Member
There was a problem hiding this comment.
Suggested change
| 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 !
Comment on lines
+238
to
+241
| if url_to_check: | ||
| pass | ||
| else: | ||
| break |
Member
There was a problem hiding this comment.
Suggested change
| if url_to_check: | |
| pass | |
| else: | |
| break | |
| if not url_to_check: | |
| break |
| else: | ||
| break | ||
|
|
||
| while (url_to_check): |
Member
There was a problem hiding this comment.
Suggested change
| while (url_to_check): | |
| while url_to_check: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Linked to
Preview