- attempt to make more strict timeout
This commit is contained in:
parent
c5ded800b9
commit
26098649f2
|
|
@ -222,14 +222,13 @@ class QualtestBackend:
|
|||
url = utils.join_host_and_path(self.address, "/play_audio/?") + params
|
||||
|
||||
# Get response from server
|
||||
response = urllib.request.urlopen(url, timeout=utils.NETWORK_TIMEOUT)
|
||||
if response.getcode() != 200:
|
||||
utils.log_error("Failed to get audio. Error code: %s" % response.getcode())
|
||||
response = requests.get(url, timeout=(utils.NETWORK_TIMEOUT, 5))
|
||||
if response.status_code != 200:
|
||||
utils.log_error("Failed to get audio. Error code: %s" % response.status_code)
|
||||
return False
|
||||
|
||||
audio_content = response.read()
|
||||
with open (output_path, 'wb') as f:
|
||||
f.write(audio_content)
|
||||
f.write(response.content)
|
||||
|
||||
return True
|
||||
except Exception as err:
|
||||
|
|
|
|||
Loading…
Reference in New Issue