Skip to content

Commit c6e984d

Browse files
authored
fix: properly insert recipe scraper version into user agent string (#1071)
1 parent ad66dfd commit c6e984d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backend/app/service/recipe_scraping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Any
33
from recipe_scrapers import scrape_html
44
from recipe_scrapers._exceptions import SchemaOrgException
5-
import recipe_scrapers.__version__
5+
from recipe_scrapers.__version__ import __version__ as recipe_scrapers_version
66
import requests
77
from app.config import FRONT_URL
88
from app.errors import ForbiddenRequest
@@ -13,7 +13,7 @@
1313

1414
# taken from the recipe-scrapers library to circumvent anti-scraping measures that block requests with the default user agent
1515
HEADERS = {
16-
"User-Agent": f"Mozilla/5.0 (compatible; Windows NT 10.0; Win64; x64; rv:{recipe_scrapers.__version__}) recipe-scrapers/{recipe_scrapers.__version__}",
16+
"User-Agent": f"Mozilla/5.0 (compatible; Windows NT 10.0; Win64; x64; rv:{recipe_scrapers_version}) recipe-scrapers/{recipe_scrapers_version}",
1717
}
1818

1919

0 commit comments

Comments
 (0)