Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
wirthual committed Jun 18, 2024
1 parent c738387 commit 58b32de
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/deutschland/lebensmittelwarnung/lebensmittelwarnung.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WarningFeedUrl:
"kosmetischemittel",
"bedarfsgegenstaende",
"mittelzumtaetowieren",
"babyundkinderprodukte"
"babyundkinderprodukte",
]

VALID_REGION_SELECTORS = [
Expand All @@ -41,25 +41,22 @@ class WarningFeedUrl:
"thueringen",
]

SOURCE_STRING = (
"https://www.lebensmittelwarnung.de/___LMW-Redaktion/RSSNewsfeed/Functions/RssFeeds/rssnewsfeed_Alle_DE.xml?nn=314268{0}{1}"
)
SOURCE_STRING = "https://www.lebensmittelwarnung.de/___LMW-Redaktion/RSSNewsfeed/Functions/RssFeeds/rssnewsfeed_Alle_DE.xml?nn=314268{0}{1}"

def __init__(self, content: str, region: str):
if (
content in self.VALID_CONTENT_SELECTORS
and region in self.VALID_REGION_SELECTORS
):
if content=="alle":
content=""
if content == "alle":
content = ""
else:
content=f"&type={content}"
content = f"&type={content}"

if region=="alle_bundeslaender":
region=""
if region == "alle_bundeslaender":
region = ""
else:
region=f"&state={region}"

region = f"&state={region}"

self.url = self.SOURCE_STRING.format(content, region)
else:
Expand Down Expand Up @@ -132,8 +129,9 @@ def __parse(self, warning_raw: PageElement) -> str:
self.dict["guid"] = guid
self.dict["pubDate"] = warning_raw.find("pubDate").text
self.dict["description"] = warning_raw.find("description").text
self.dict["link"]=guid
self.dict["link"] = guid
self.dict["title"] = warning_raw.find("title").text

def get_warning(self) -> dict:
return self.dict

Expand Down

0 comments on commit 58b32de

Please sign in to comment.