- better log formatting
This commit is contained in:
parent
5734dea39e
commit
c4aead0300
|
|
@ -213,7 +213,7 @@ class QualtestBackend:
|
||||||
|
|
||||||
|
|
||||||
def load_audio(self, audio_id: int, output_path: Path):
|
def load_audio(self, audio_id: int, output_path: Path):
|
||||||
utils.log(f'Loading audio with ID: {audio_id}')
|
utils.log(f'Loading audio with ID: {audio_id} ...')
|
||||||
try:
|
try:
|
||||||
# Build query for both V1 & V2 API
|
# Build query for both V1 & V2 API
|
||||||
params = urllib.parse.urlencode({"audio_id": audio_id})
|
params = urllib.parse.urlencode({"audio_id": audio_id})
|
||||||
|
|
@ -224,13 +224,13 @@ class QualtestBackend:
|
||||||
# Get response from server
|
# Get response from server
|
||||||
response = requests.get(url, timeout=(utils.NETWORK_TIMEOUT, 5))
|
response = requests.get(url, timeout=(utils.NETWORK_TIMEOUT, 5))
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
utils.log_error(f' Failed to get audio. Error code: {response.status_code}, msg: {response.content}')
|
utils.log_error(f' Failed to get audio. Error code: {response.status_code}, msg: {response.content}')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
with open (output_path, 'wb') as f:
|
with open (output_path, 'wb') as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
|
|
||||||
utils.log(' Done.')
|
utils.log(' Done.')
|
||||||
return True
|
return True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
utils.log_error(f' Exception when fetching audio: {str(err)}')
|
utils.log_error(f' Exception when fetching audio: {str(err)}')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue