-
Notifications
You must be signed in to change notification settings - Fork 375
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
base: master
Are you sure you want to change the base?
Solution #364
Conversation
There was a problem hiding this 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: |
There was a problem hiding this comment.
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]: |
There was a problem hiding this comment.
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]: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
.
No description provided.