Add missing requirement and set locale to German

This commit is contained in:
Johannes Rothe 2022-02-23 21:50:54 +01:00
parent e2ab2cdffd
commit c6d39ee579
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,3 @@
# scraperoog # Requirements
`apt install python3-pydantic python3-httpx python3-bs4 locales-all` `apt install python3-pydantic python3-httpx python3-bs4 python3-tqdm locales-all && sudo locale-gen`
`sudo locale-gen`

View File

@ -2,6 +2,7 @@ import asyncio
import csv import csv
import json import json
import locale import locale
locale.setlocale(locale.LC_TIME, "German") # dates on that page are German
import pickle import pickle
import platform import platform
from configparser import ConfigParser from configparser import ConfigParser
@ -74,7 +75,6 @@ def generate_csv(result: Result) -> None:
def convert_to_datestring(day: str, month: str, year: str) -> datetime: def convert_to_datestring(day: str, month: str, year: str) -> datetime:
locale.setlocale(locale.LC_TIME, "")
date = datetime.strptime(f"{day.zfill(2)} {month} {year}", "%d %B %Y") date = datetime.strptime(f"{day.zfill(2)} {month} {year}", "%d %B %Y")
return date return date