mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Show errors returned via HTTP 400
This commit is contained in:
parent
0fff0a4de1
commit
aa5f17cbdb
@ -1,6 +1,7 @@
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from twitchdl import CLIENT_ID
|
from twitchdl import CLIENT_ID
|
||||||
|
from twitchdl.exceptions import ConsoleError
|
||||||
from twitchdl.parse import parse_playlists, parse_playlist
|
from twitchdl.parse import parse_playlists, parse_playlist
|
||||||
|
|
||||||
|
|
||||||
@ -8,6 +9,10 @@ def authenticated_get(url, params={}):
|
|||||||
headers = {'Client-ID': CLIENT_ID}
|
headers = {'Client-ID': CLIENT_ID}
|
||||||
|
|
||||||
response = requests.get(url, params, headers=headers)
|
response = requests.get(url, params, headers=headers)
|
||||||
|
if response.status_code == 400:
|
||||||
|
data = response.json()
|
||||||
|
raise ConsoleError(data["message"])
|
||||||
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
Loading…
Reference in New Issue
Block a user