Skip to content

update docstrings #13

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

Merged
merged 1 commit into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions modules/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@


def url_canon(website, verbose):
"""
""" URL normalisation/canonicalization

:param website: String -
:param verbose: Boolean -
:return: String 'website' -
:param website: String - URL of website.
:param verbose: Boolean - Verbose logging switch.
:return: String 'website' - normalised result.
"""
if not website.startswith("http"):
if not website.startswith("www."):
Expand All @@ -29,17 +29,18 @@ def url_canon(website, verbose):


def extract_domain(url, remove_http=True):
"""
""" Parses the provided 'url' to provide only the netloc or
scheme + netloc parts of the provided url.

:param url: String -
:param remove_http: Boolean -
:return: String 'domain_name' -
:param url: String - Url to parse.
:param remove_http: Boolean
:return: String 'domain_name' - Resulting parsed Url
"""
uri = urlparse(url)
if remove_http:
domain_name = f"{uri.netloc}"
else:
domain_name = f"{uri.netloc}://{uri.netloc}"
domain_name = f"{uri.scheme}://{uri.netloc}"
return domain_name


Expand Down
6 changes: 3 additions & 3 deletions modules/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, website, c_depth, c_pause, out_path, logs, verbose):
def excludes(self, link):
""" Excludes links that are not required.

:param link:
:param link: String
:return: Boolean
"""
# BUG: For NoneType Exceptions, got to find a solution here
Expand Down Expand Up @@ -57,8 +57,8 @@ def excludes(self, link):
def canonical(self, link):
""" Canonization of the link.

:param link:
:return:
:param link: String
:return: String 'final_link': parsed canonical url.
"""
# Already formatted
if link.startswith(self.website):
Expand Down
2 changes: 1 addition & 1 deletion torcrawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def main():
website = ''
out_path = ''

# Canon/ion of website and create path for output
# Canonicalization of web url and create path for output.
if len(args.url) > 0:
website = url_canon(args.url, args.verbose)
if args.folder is not None:
Expand Down