Catch specific Exception

This commit is contained in:
Davte 2019-07-12 14:16:38 +02:00
parent a2965be066
commit c46f6fee52

View File

@ -195,7 +195,7 @@ async def async_request(url, type='get', mode='json', encoding='utf-8',
result = json.loads( result = json.loads(
result result
) )
except Exception as e: except json.decoder.JSONDecodeError:
result = {} result = {}
elif mode == 'html': elif mode == 'html':
result = BeautifulSoup(result, "html.parser") result = BeautifulSoup(result, "html.parser")