From fe644aa9fdd51330aea40eda483ff40401bcb360 Mon Sep 17 00:00:00 2001 From: fwkz <f4wkes@gmail.com> Date: Thu, 21 Apr 2016 22:41:09 +0200 Subject: [PATCH] Simplifying http_request() API to avoid conflicts with requests package. --- routersploit/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routersploit/utils.py b/routersploit/utils.py index cd86317..a393a6c 100644 --- a/routersploit/utils.py +++ b/routersploit/utils.py @@ -276,11 +276,13 @@ def random_text(length, alph=string.letters+string.digits): return ''.join(random.choice(alph) for _ in range(length)) -def http_request(method, url, verify=False, **kwargs): +def http_request(method, url, **kwargs): """ Wrapper for 'requests' silencing exceptions a little bit. """ + kwargs.setdefault('verify', False) + try: - return getattr(requests, method.lower())(url, verify=verify, **kwargs) + return getattr(requests, method.lower())(url, **kwargs) except (requests.exceptions.MissingSchema, requests.exceptions.InvalidSchema): print_error("Invalid URL format: {}".format(url)) return -- libgit2 0.26.0