Skip to content

feat: Detailed report#69

Merged
pythonbrad merged 3 commits into
mainfrom
patchz
Sep 15, 2022
Merged

feat: Detailed report#69
pythonbrad merged 3 commits into
mainfrom
patchz

Conversation

@pythonbrad
Copy link
Copy Markdown
Member

@pythonbrad pythonbrad commented Sep 15, 2022

Change

  • Added URL information on the report
  • Added a short checking stats

Linked to

Preview

a

Added URL information on the report
Added a short checking stats
@pythonbrad pythonbrad self-assigned this Sep 15, 2022
Copy link
Copy Markdown
Member

@Sanix-Darker Sanix-Darker left a 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 !

Comment thread 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"\
Copy link
Copy Markdown
Member

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:

Suggested change
f"Check time: {info['check_time']} seconds\n"\
f"Check time: {round(info['check_time'], 4)} seconds\n"\

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

Comment thread blc/checker.py Outdated
"""
# 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]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread blc/checker.py
'url': origin_url,
'result': None,
'check_time': None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment thread blc/checker.py
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']]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread blc/checker.py Outdated
Comment on lines +238 to +241
if url_to_check:
pass
else:
break
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if url_to_check:
pass
else:
break
if not url_to_check:
break

Comment thread blc/checker.py Outdated
else:
break

while (url_to_check):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while (url_to_check):
while url_to_check:

@pythonbrad pythonbrad merged commit d783542 into main Sep 15, 2022
@pythonbrad pythonbrad deleted the patchz branch September 15, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants