Commit fe644aa9 by fwkz

Simplifying http_request() API to avoid conflicts with requests package.

parent 0487bfab
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment