Chequeo user agents en _do_request
This commit is contained in:
@@ -28,6 +28,8 @@ def _do_request(url):
|
||||
"""
|
||||
if not url:
|
||||
raise ValueError('URL cant be empty')
|
||||
if not HEADERS['user-agent']:
|
||||
raise ValueError('User Agent isn\'t set')
|
||||
|
||||
_log.info('Doing request to "%s" with headers %s', url, HEADERS)
|
||||
response = requests.get(url, headers=HEADERS)
|
||||
@@ -52,9 +54,6 @@ def _do_request_mb(url):
|
||||
:return: The dictionary with the response or the status and his an error message
|
||||
"""
|
||||
|
||||
if not HEADERS['user-agent']:
|
||||
raise ValueError('User Agent isn\'t set')
|
||||
|
||||
response = _do_request(url)
|
||||
|
||||
if response.status_code == 200:
|
||||
@@ -79,8 +78,6 @@ def _do_request_ca(url):
|
||||
:raises ValueError when user-agent isn't set
|
||||
:return: The dictionary with the response or the status and his an error message
|
||||
"""
|
||||
if not HEADERS['user-agent']:
|
||||
raise ValueError('User Agent isn\'t set')
|
||||
|
||||
response = _do_request(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user