Skip to content
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

Solution #364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #364

wants to merge 1 commit into from

Conversation

frontbastard
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the task requirements! 🎉 Your code successfully scrapes quotes and writes them to a CSV file, handling pagination effectively. While there are minor issues with type hints and handling potential empty responses, these don't impact the core functionality. Keep up the good work, and consider refining these areas for even cleaner code in the future! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

QUOTES_FIELDS = [field.name for field in fields(Quote)]


def get_content(url: str) -> Response | str:

Choose a reason for hiding this comment

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

The return type hint Response | str is correct, but be aware that accessing .content on a string (as done later) will raise an AttributeError. Consider handling this case where the return value might be an empty string.

)


def get_single_page_quotes(page_soup: Tag) -> [Quote]:

Choose a reason for hiding this comment

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

The type hint [Quote] is not valid. Use List[Quote] instead, and make sure to import List from typing.

return [parse_single_quote(quote) for quote in quotes]


def get_all_quotes() -> [Quote]:

Choose a reason for hiding this comment

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

The type hint [Quote] is not valid. Use List[Quote] instead, and make sure to import List from typing.

return all_quotes


def write_quotes_to_csv(quotes: [Quote], output_csv_path: str) -> None:

Choose a reason for hiding this comment

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

The type hint [Quote] is not valid. Use List[Quote] instead, and make sure to import List from typing.

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