From 1297e0376bf4e921bf16bdb49e962295ff6260b7 Mon Sep 17 00:00:00 2001 From: Marc Michalsky Date: Thu, 2 Sep 2021 16:17:07 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=EF=B8=8F=20create=20tmp=20folder?= =?UTF-8?q?=20if=20it=20does=20not=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models.py b/models.py index 2d034d3..f978ccd 100644 --- a/models.py +++ b/models.py @@ -41,6 +41,13 @@ class TazDownloader: Downloads a newspaper from dl.taz.de and stores it in /tmp """ + # Check if folder exists + try: + if not os.path.isdir(dir_path): + os.mkdirs(dir_path) + except Exception as e: + raise TazDownloadError(f"Could find or create \"{dir_path}\":\n{e}") + # download taz try: with requests.get( From 1def0944b5c91380a8370444064dd0b3da1bf59f Mon Sep 17 00:00:00 2001 From: Marc Michalsky Date: Thu, 2 Sep 2021 16:20:00 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=E2=AC=87=EF=B8=8F=20to=20pandas=201.1.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 45d62c5..69ba6d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pandas~=1.3.2 +pandas~=1.1.5 envyaml~=1.8.210417 requests~=2.26.0 beautifulsoup4~=4.9.3 \ No newline at end of file From e5445cb6b1f87ba8881ce5a2abfb504f824ecb29 Mon Sep 17 00:00:00 2001 From: Marc Michalsky Date: Thu, 2 Sep 2021 16:26:59 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20bug=20fix:=20error=20when=20?= =?UTF-8?q?deleting=20from=20download=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 58a5a74..4d4703f 100644 --- a/main.py +++ b/main.py @@ -49,7 +49,7 @@ try: newspaper_available = taz_dl.scrape_newspaper() # Remove outdated newspaper from download_history.csv - df.drop([f.index for f in df['file'] if f not in newspaper_available], inplace=True) + df.drop([index for index, row in df.iterrows() if row.file not in newspaper_available], inplace=True) # Find newspaper which are not already downloaded newspaper_to_download = [n for n in newspaper_available if n not in df.file.values]