twitchAPI.helper¶
Helper functions
-
twitchAPI.helper.
build_scope
(scopes: List[twitchAPI.types.AuthScope]) → str¶ Builds a valid scope string from list
Parameters: scopes (list[AuthScope]) – list of AuthScope
Return type: str Returns: the valid auth scope string
-
twitchAPI.helper.
build_url
(url: str, params: dict, remove_none=False, split_lists=False, enum_value=True) → str¶ Build a valid url string
Parameters: - url – base URL
- params – dictionary of URL parameter
- remove_none (bool) – if set all params that have a None value get removed
Returns: URL
Return type:
-
twitchAPI.helper.
extract_uuid_str_from_url
(url: str) → Optional[str]¶ Extracts a UUID string from a URL
Parameters: url (str) – The URL to parse Returns: UUID string extracted from given URL or None if no UUID found Return type: Union[str, None]
-
twitchAPI.helper.
fields_to_enum
(data: Union[dict, list], fields: List[str], _enum: Type[enum.Enum], default: Optional[enum.Enum]) → Union[dict, list]¶ Itterates a dict or list and tries to replace every dict entry with key in fields with the correct Enum value
Parameters: Return type:
-
twitchAPI.helper.
get_json
(request: aiohttp.web_request.Request) → Union[list, dict, None]¶ Tries to retrieve the json object from the body
Parameters: request – the request Returns: the object in the body or None