From ade7d63231c2f8faf1475366f421c1e22c20f984 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 25 Sep 2020 15:30:49 -0700 Subject: [PATCH] Use voussoirkit safeprint instead of duplicate function. --- voussoirkit/downloady.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/voussoirkit/downloady.py b/voussoirkit/downloady.py index 558182f..1ad347f 100644 --- a/voussoirkit/downloady.py +++ b/voussoirkit/downloady.py @@ -8,6 +8,7 @@ import warnings from voussoirkit import bytestring from voussoirkit import ratelimiter from voussoirkit import clipext +from voussoirkit import safeprint warnings.simplefilter('ignore') @@ -53,8 +54,8 @@ def download_file( localname = os.path.abspath(localname) if verbose: - safeprint(' URL:', url) - safeprint('File:', localname) + safeprint.safeprint(f' URL: {url}') + safeprint.safeprint(f'File: {localname}') plan = prepare_plan( url, @@ -371,10 +372,6 @@ def request(method, url, stream=False, headers=None, timeout=TIMEOUT, verify_ssl req.raise_for_status() return req -def safeprint(*texts, **kwargs): - texts = [str(text).encode('ascii', 'replace').decode() for text in texts] - print(*texts, **kwargs) - def sanitize_filename(text, exclusions=''): to_remove = FILENAME_BADCHARS for exclude in exclusions: