Python SDK for WebSuckIt integration
Project description
web-suck-it-py
Python SDK for websuckit
For tutorials and more in-depth information about websuckit Channels, visit our official docs.
Usage Overview
The following topics are covered:
Installation
Using poetry
poetry add web-suck-it-py
Initialization
from web_suck_it_py import WebSuckIt
from os import getenv
handler = WebSuckIt(
user_id=UUID(getenv("USER_ID")),
access_key=getenv("ACCESS_KEY"),
public_key=getenv("PUBLIC_KEY"),
)
You can get your USER_ID
, ACCESS_KEY
and PUBLIC_KEY
from the websuckit dashboard.
Channel
Accessing a channel's websocket URL
It is possible to access a channel websocket URL by channel name, through the get_connection_url
function
from web_suck_it_py import GetChannelRequest
connection_url = handler.get_connection_url(
channel_name="CHANNEL-NAME",
channel_pass_key="CHANNEL-PASS-KEY",
replay_self=False,
)
Create channel
from web_suck_it_py import CreateChannelRequest
from web_suck_it_py import Channel
channel: Channel = handler.create_channel(
CreateChannelRequest(
channel="new-channel-name",
max_connections=2,
)
)
Get channel
from web_suck_it_py import GetChannelRequest
from web_suck_it_py import Channel
channel: Channel = handler.get_channel(
GetChannelRequest(
channel_name = "CHANNEL-NAME",
)
)
Get channels (paginated)
from typing import List
from web_suck_it_py import GetChannelListRequest
from web_suck_it_py import Channel
channels: List[Channel] = handler.get_channels(
GetChannelListRequest(
page=0,
per_page=10,
search_key="search-channel",
)
)
Get or Create channel
from web_suck_it_py import GetOrCreateChannelRequest
from web_suck_it_py import Channel
channel: Channel = handler.get_or_create_channel(
GetOrCreateChannelRequest(
channel_name = "CHANNEL-NAME",
)
)
Update channel
from uuid import UUID
from web_suck_it_py import UpdateChannelRequest
from web_suck_it_py import Channel
channel: Channel = handler.update_channel(
UpdateChannelRequest(
# set to channel id
channel_id=UUID(""),
regenerate_pass_key=False,
# set `channel` to change channel name
channel="change-channel-name",
# set `max_connections` to change maximum concurrent connections
max_connections=5,
)
)
Delete channel
from uuid import UUID
from web_suck_it_py import DeleteChannelRequest
handler.delete_channel(
DeleteChannelRequest(
channel_id=UUID(""),
)
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
web_suck_it_py-0.0.1.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file web_suck_it_py-0.0.1.tar.gz
.
File metadata
- Download URL: web_suck_it_py-0.0.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ac7b3cc41cfaf154d6758c4ae612e7ced86f1c08d376a0fdb57423438b7db63 |
|
MD5 | e208b46e6992d6e0aeb58394d0c444fb |
|
BLAKE2b-256 | c10d28d9c69f76f60203fb33362327c74d554b1576574d63648b0ca5d2e04802 |
File details
Details for the file web_suck_it_py-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: web_suck_it_py-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.11.6 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54c620632d4e01bc8458385ef35d2c7e4b5b081d289f820394c9ecb6c5fa14ae |
|
MD5 | e5aec36dac1cd069fc4cba101a5eaa72 |
|
BLAKE2b-256 | 841d8c32e71cce528ab00b8c756ca318f2184ecb25615b4fab36e9ff1c53c176 |