From 625ed6348295e9f89560cc0c370e87fdd0a0cd1b Mon Sep 17 00:00:00 2001 From: Akash Mahanty Date: Sun, 10 Jan 2021 03:05:48 +0530 Subject: [PATCH] remove asserts stmnts --- waybackpy/cdx.py | 2 -- waybackpy/utils.py | 21 +++++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/waybackpy/cdx.py b/waybackpy/cdx.py index ccef8b9..ae50f7b 100644 --- a/waybackpy/cdx.py +++ b/waybackpy/cdx.py @@ -1,7 +1,6 @@ from .snapshot import CdxSnapshot from .exceptions import WaybackError from .utils import ( - _full_url, _get_total_pages, _get_response, default_user_agent, @@ -122,7 +121,6 @@ class Cdx: if len(lines) >= 3: - last_line = lines[-1] second_last_line = lines[-2] if len(second_last_line) == 0: diff --git a/waybackpy/utils.py b/waybackpy/utils.py index bec77b1..41656e7 100644 --- a/waybackpy/utils.py +++ b/waybackpy/utils.py @@ -70,9 +70,11 @@ def _check_collapses(collapses): N = match.group(2) if N: - assert field + N == c + if not (field + N == c): + raise Exception else: - assert field == c + if not (field == c): + raise Exception except Exception: e = "collapse argument '%s' is not following the cdx collapse syntax." % c @@ -94,21 +96,8 @@ def _check_filters(filters): key = match.group(1) val = match.group(2) - if "statuscode" in key: - assert len(val) == 3 - assert isinstance(int(val), int) == True - if "timestamp" in key: - - int_ts = int(val) - assert len(val) == 14 # must be 14 and not less to filter - assert int_ts > 19_950_000_000_000 # year 1995, 14 digit ts - assert isinstance(int_ts, int) == True - - if "original" in key: - assert "http" in val - - except Exception as e: + except Exception: e = "Filter '%s' not following the cdx filter syntax." % f raise WaybackError(e)