mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
Add type hints for post
This commit is contained in:
parent
3fa8bcef73
commit
9aa108acbf
@ -3,7 +3,7 @@ Twitch API access.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from typing import Dict, Generator, List, Literal, Mapping, Optional, Tuple, TypedDict
|
from typing import Dict, Generator, List, Literal, Mapping, Optional, Tuple, TypedDict, Union
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import httpx
|
import httpx
|
||||||
@ -87,7 +87,15 @@ class GQLError(click.ClickException):
|
|||||||
super().__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
def authenticated_post(url, content=None, json=None, headers={}):
|
RequestContent = Union[str, bytes]
|
||||||
|
|
||||||
|
|
||||||
|
def authenticated_post(
|
||||||
|
url: str,
|
||||||
|
content: Optional[RequestContent] = None,
|
||||||
|
json=None,
|
||||||
|
headers={},
|
||||||
|
):
|
||||||
headers["Client-ID"] = CLIENT_ID
|
headers["Client-ID"] = CLIENT_ID
|
||||||
|
|
||||||
response = httpx.post(url, content=content, json=json, headers=headers)
|
response = httpx.post(url, content=content, json=json, headers=headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user