Skip to content

Commit

Permalink
Add example of a fallback decorator in use
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison committed Oct 21, 2022
1 parent 12be806 commit 10da8ad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions templates/scraper.py
@@ -1,6 +1,7 @@
# mypy: allow-untyped-defs

from ._abstract import AbstractScraper
from ._decorators import opengraph_fallback


class Template(AbstractScraper):
Expand All @@ -25,3 +26,8 @@ def ingredients(self):

def instructions(self):
return self.schema.instructions()

# Fallback decorators are called when the method fails to return a value
@opengraph_fallback
def image(self):
pass

0 comments on commit 10da8ad

Please sign in to comment.