Skip to content

AttributeError when the webpage title(soup.title) is empty. #5

@bytecategory

Description

@bytecategory

My solution:
Change

if soup.title.string in ["Citrix Gateway", "NetScaler AAA", "Digital Workplace", "NetScaler Gateway"]:
    title_check = True
    logging.info(f"{url} - Title Check Passed")

to

title = soup.title.string.strip() if soup.title and soup.title.string else None
if title in ["Citrix Gateway", "NetScaler AAA", "Digital Workplace", "NetScaler Gateway"]:
    title_check = True
    logging.info(f"{url} - Title Check Passed")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions