From 15f48bc457f41d649fd54c2e9b9436a2bc3c950d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Indig?= Date: Fri, 7 Aug 2020 11:34:02 +0200 Subject: [PATCH] Handle UnicodeError, add Makefile to aid packaging --- Makefile | 11 +++++++++++ webarticlecurator/enhanced_downloader.py | 2 +- webarticlecurator/version.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..26a38a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +all: + @echo "See Makefile for possible targets!" + +build: + python3 setup.py sdist bdist_wheel + +upload: + python3 -m twine upload dist/* + +clean: + rm -rf dist/ build/ webarticlecurator.egg-info/ diff --git a/webarticlecurator/enhanced_downloader.py b/webarticlecurator/enhanced_downloader.py index 84bc749..25e8a68 100644 --- a/webarticlecurator/enhanced_downloader.py +++ b/webarticlecurator/enhanced_downloader.py @@ -239,7 +239,7 @@ def _download_url(self, url): try: # The actual request resp = self._requests_get(url, headers=self._req_headers, stream=True, verify=self._verify_request) - except RequestException as err: + except (UnicodeError, RequestException) as err: # UnicodeError is originated from idna codec error self._handle_request_exception(url, 'RequestException happened during downloading: {0} \n\n' ' The program ignores it and jumps to the next one.'.format(err)) return None diff --git a/webarticlecurator/version.py b/webarticlecurator/version.py index 65ceec2..3c16c2d 100644 --- a/webarticlecurator/version.py +++ b/webarticlecurator/version.py @@ -1,4 +1,4 @@ #!/usr/bin/env pyhton3 # -*- coding: utf-8, vim: expandtab:ts=4 -*- -__version__ = '1.0.1' +__version__ = '1.0.2'