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.2.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file web_suck_it_py-0.0.2.tar.gz
.
File metadata
- Download URL: web_suck_it_py-0.0.2.tar.gz
- Upload date:
- Size: 6.9 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 | 26ad6c20146cf571cfdca0959091cb6af46591b80adade886b128348160bd4cd |
|
MD5 | b8dadea3aef2bd7492166604437a9e6d |
|
BLAKE2b-256 | e2bc4d460b0aee141acb2c444316463aa3868fea184dbd7d24f29ace58807121 |
File details
Details for the file web_suck_it_py-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: web_suck_it_py-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.2 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 | 05d890cc608d5a2e6531a9e8a3d7fc8ddfca65cb8aaf3de5be98679c9cf96e74 |
|
MD5 | dcd23b7a3ef68eb32fba30e59ef281db |
|
BLAKE2b-256 | 5aadc89a9dbcfbcdd3a17cf6400af94871318cc12998bb032cc2d551097e4562 |