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
Update the scraper-generator template. Inherit from abc.ABC in AbstractScraper #664
Conversation
Hmm. Or perhaps we should match the fields to the default-exception-handling field list. |
Nope, I don't think so after all. A few of those fields are definitely optional (and in fact, |
2f5e78b
to
10da8ad
Compare
A related idea: we could make As usual, I'm not sure whether it's worthwhile. It'd be stricter - but is that good for developers and the library? And what are the required elements of a recipe? (ingredients and instructions, certainly - anything else?) |
I'm on board with the idea of inheriting The 'core' recipe fields are: |
3886a67
to
f502afa
Compare
@@ -12,6 +12,10 @@ def host(cls): | |||
def title(self): | |||
return self.soup.find("meta", {"property": "og:title"})["content"] | |||
|
|||
def total_time(self): |
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.
In case where site does not have time information for their recipes:
raise RecipeScrapersExceptions(f"{self.host} does not provide time information.")
or sth along these lines to set an example.
I really like what I see here! Why the CI didn't run 🤔 Is it a glitch or I'm missing something |
Thanks for the review! Ah, CI didn't run here because the branch changed (originally I had this stacked onto some of the decorator-related field retrieval). Should be fixed when I push a commit for the exception change. |
Should we consider this a breaking/major version change? (I hadn't thought of this until now, but it could cause breakage for anyone developing private scrapers inherited from |
Ah nice thinking .. do not merge into This would be a major version bump indeed and I'd like us to unite it with other things (removal of the settings module, some scrapers updates due to the health check thing and I probably forget other things we'll introduce too). Not sure what's the best way to notify current package users. Ideally minor version bump with message during install 🤔 (not sure how this can be done). Simply a message when recipe_scrapers is imported might work too. |
Ok, the |
…abstract base class
…arest the top of the class definition
It could be worth figuring out what (if anything) to do about the I feel like those could cause a bunch of merge conflicts between ( |
f502afa
to
3ea825e
Compare
…overall diff to v15 branch
Perhaps we should only include 'core' recipe fields within the auto-generated scrapers. This pull request
omitsoriginally omitted a few fields that I'd consider more on the optional side, related to recipes. Inspired by discussion in #663 (cc @bickerdyke).It's always possible for people to implement the additional fields - and that should happen naturally over time when people decide that they want that information.
This would reduce the work to implement scrapers from scratch, particularly time spent putting together test case data and implementing BeautifulSoup queries.