Skip to content

Commit

Permalink
merged with feature updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gub-7 committed Nov 30, 2024
2 parents 1215cda + 9e6dc8a commit 2226edb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Our docs are being hosted on https://kickpy.cibere.dev
Install from github _requires [git](https://git-scm.com/) to be installed_

```bash
pip install git+https://github.com/gub-7/kick.py
pip install git+https://github.com/cibere/kick.py
```

If you are api whitelisted (meaning you are whitelisted from cloudflare), then you can pass `whitelisted=True` to your `Client` constructor. Otherwise you should setup the bypass script.
Expand Down
9 changes: 9 additions & 0 deletions kick/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,17 @@ async def fetch_user(self, name: str, /) -> User:
async def fetch_stream_url_and_key(self) -> DestinationInfo:
"""
|coro|
Fetches your stream URL and stream key from the API.
You must be authenticated to use this endpoint.
Raises
-----------
HTTPException
Fetching Failed
Forbidden
You are not authenticated
Returns
-----------
DestinationInfo
Expand Down Expand Up @@ -257,10 +260,16 @@ async def set_stream_info(
The name of the game/category (optional)
is_mature: bool
Whether the stream is marked as mature content
Raises
-----------
HTTPException
Failed to update stream information
Returns
-----------
StreamInfo
The stream info that was set to the logged in user's channel.
"""

data = await self.http.set_stream_info(title, subcategory_name, subcategory_id, language, is_mature)
Expand Down
6 changes: 1 addition & 5 deletions kick/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,7 @@ async def request(self, route: Route, **kwargs) -> Any:
try:
res = await self.__session.request(
route.method,
(
url
if self.whitelisted is True
else f"{self.bypass_host}:{self.bypass_port}/request?url={url}"
),
url, # Use the already constructed URL
headers=headers,
cookies=cookies,
**kwargs,
Expand Down
8 changes: 8 additions & 0 deletions kick/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
__all__ = ("DestinationInfo", "Socials", "PartialUser", "User", "ClientUser",
"StreamInfo")

from .types.user import (
ClientUserPayload,
InnerUser,
UserPayload,
StreamInfoPayload,
DestinationInfoPayload
)


class DestinationInfo(BaseDataclass["DestinationInfoPayload"]):
"""
Expand Down
5 changes: 4 additions & 1 deletion kick/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from typing import TYPE_CHECKING

from aiohttp import ClientWebSocketResponse as WebSocketResponse

import logging
from .livestream import PartialLivestream
from .message import Message

if TYPE_CHECKING:
from .http import HTTPClient

LOG = logging.getLogger(__name__)

__all__ = ()


Expand All @@ -23,6 +25,7 @@ def __init__(self, ws: WebSocketResponse, *, http: HTTPClient):

async def poll_event(self) -> None:
raw_msg = await self.ws.receive()
LOG.debug(f"WS received: {raw_msg}")
raw_data = raw_msg.json()
data = json.loads(raw_data["data"])

Expand Down

0 comments on commit 2226edb

Please sign in to comment.