mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Pass request as content instead of data
data works, but should be used for form data passed as a dict, while content takes bytes or str
This commit is contained in:
parent
3c0f8a8ece
commit
3fa8bcef73
@ -87,10 +87,10 @@ class GQLError(click.ClickException):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
def authenticated_post(url, data=None, json=None, headers={}):
|
||||
def authenticated_post(url, content=None, json=None, headers={}):
|
||||
headers["Client-ID"] = CLIENT_ID
|
||||
|
||||
response = httpx.post(url, data=data, json=json, headers=headers)
|
||||
response = httpx.post(url, content=content, json=json, headers=headers)
|
||||
if response.status_code == 400:
|
||||
data = response.json()
|
||||
raise ConsoleError(data["message"])
|
||||
@ -102,7 +102,7 @@ def authenticated_post(url, data=None, json=None, headers={}):
|
||||
|
||||
def gql_post(query: str):
|
||||
url = "https://gql.twitch.tv/gql"
|
||||
response = authenticated_post(url, data=query)
|
||||
response = authenticated_post(url, content=query)
|
||||
gql_raise_on_error(response)
|
||||
return response.json()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user