# web-suck-it-py
Python SDK for websuckit
[![Test CI](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/test.yml/badge.svg)](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/test.yml)
[![Deploy to PyPi](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/deploy.yml/badge.svg)](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/deploy.yml)
![PyPI - Version](https://img.shields.io/pypi/v/web-suck-it-py)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/web-suck-it-py)
For tutorials and more in-depth information about websuckit Channels, visit
our [official docs](https://docs.websuckit.com).
## Usage Overview
The following topics are covered:
* [Installation](https://github.com/WebSuckIt/web-suck-it-py#installation)
* [Initialization](https://github.com/websuckit/web-suck-it-py#initialization)
* [Channels](https://github.com/WebSuckIt/web-suck-it-py#channel)
* [Create Channel](https://github.com/WebSuckIt/web-suck-it-py#channel)
* [Get Channel](https://github.com/WebSuckIt/web-suck-it-py#channel)
* [Get Channels](https://github.com/WebSuckIt/web-suck-it-py#get-channels-paginated)
* [Get or Create Channel](https://github.com/WebSuckIt/web-suck-it-py#get-or-create-channel)
* [Update Channel](https://github.com/WebSuckIt/web-suck-it-py#update-channel)
* [Delete Channel](https://github.com/WebSuckIt/web-suck-it-py#delete-channel)
* [Accessing a channel's websocket URL](https://github.com/WebSuckIt/web-suck-it-py#accessing-a-channels-websocket-url)
## Installation
Using poetry
```bash
poetry add web-suck-it-py
```
## Initialization
```py
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](https://websuckit.com/api-keys).
## 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
```py
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
```py
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
```py
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)
```py
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
```py
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
```py
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
```py
from uuid import UUID
from web_suck_it_py import DeleteChannelRequest
handler.delete_channel(
DeleteChannelRequest(
channel_id=UUID(""),
)
)
```
Raw data
{
"_id": null,
"home_page": "https://websuckit.com",
"name": "web-suck-it-py",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0.0",
"maintainer_email": "",
"keywords": "websocket,communication,http,websuckit,realtime",
"author": "Diretnan Domnan",
"author_email": "diretnandomnan@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e2/bc/4d460b0aee141acb2c444316463aa3868fea184dbd7d24f29ace58807121/web_suck_it_py-0.0.2.tar.gz",
"platform": null,
"description": "# web-suck-it-py\nPython SDK for websuckit\n\n[![Test CI](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/test.yml/badge.svg)](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/test.yml)\n[![Deploy to PyPi](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/deploy.yml/badge.svg)](https://github.com/WebSuckIt/web-suck-it-py/actions/workflows/deploy.yml)\n![PyPI - Version](https://img.shields.io/pypi/v/web-suck-it-py)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/web-suck-it-py)\n\nFor tutorials and more in-depth information about websuckit Channels, visit\nour [official docs](https://docs.websuckit.com).\n\n\n## Usage Overview\n\nThe following topics are covered:\n* [Installation](https://github.com/WebSuckIt/web-suck-it-py#installation)\n* [Initialization](https://github.com/websuckit/web-suck-it-py#initialization)\n* [Channels](https://github.com/WebSuckIt/web-suck-it-py#channel)\n * [Create Channel](https://github.com/WebSuckIt/web-suck-it-py#channel)\n * [Get Channel](https://github.com/WebSuckIt/web-suck-it-py#channel)\n * [Get Channels](https://github.com/WebSuckIt/web-suck-it-py#get-channels-paginated)\n * [Get or Create Channel](https://github.com/WebSuckIt/web-suck-it-py#get-or-create-channel)\n * [Update Channel](https://github.com/WebSuckIt/web-suck-it-py#update-channel)\n * [Delete Channel](https://github.com/WebSuckIt/web-suck-it-py#delete-channel)\n * [Accessing a channel's websocket URL](https://github.com/WebSuckIt/web-suck-it-py#accessing-a-channels-websocket-url)\n\n## Installation\n\nUsing poetry\n\n```bash\npoetry add web-suck-it-py\n```\n\n## Initialization\n\n```py\nfrom web_suck_it_py import WebSuckIt\nfrom os import getenv\nhandler = WebSuckIt(\n user_id=UUID(getenv(\"USER_ID\")),\n access_key=getenv(\"ACCESS_KEY\"),\n public_key=getenv(\"PUBLIC_KEY\"),\n)\n```\n\nYou can get your `USER_ID`, `ACCESS_KEY` and `PUBLIC_KEY` from the [websuckit dashboard](https://websuckit.com/api-keys).\n\n## Channel\n\n## Accessing a channel's websocket URL\n\nIt is possible to access a channel websocket URL by channel name, through the `get_connection_url` function\n\n```py\nfrom web_suck_it_py import GetChannelRequest\nconnection_url = handler.get_connection_url(\n channel_name=\"CHANNEL-NAME\",\n channel_pass_key=\"CHANNEL-PASS-KEY\",\n replay_self=False,\n )\n```\n\n### Create channel\n\n```py\nfrom web_suck_it_py import CreateChannelRequest\nfrom web_suck_it_py import Channel\nchannel: Channel = handler.create_channel(\n CreateChannelRequest(\n channel=\"new-channel-name\",\n max_connections=2,\n )\n )\n```\n\n### Get channel\n\n```py\nfrom web_suck_it_py import GetChannelRequest\nfrom web_suck_it_py import Channel\nchannel: Channel = handler.get_channel(\n GetChannelRequest(\n channel_name = \"CHANNEL-NAME\",\n )\n )\n```\n\n### Get channels (paginated)\n\n```py\nfrom typing import List\nfrom web_suck_it_py import GetChannelListRequest\nfrom web_suck_it_py import Channel\nchannels: List[Channel] = handler.get_channels(\n GetChannelListRequest(\n page=0,\n per_page=10,\n search_key=\"search-channel\",\n )\n )\n```\n\n### Get or Create channel\n\n```py\nfrom web_suck_it_py import GetOrCreateChannelRequest\nfrom web_suck_it_py import Channel\nchannel: Channel = handler.get_or_create_channel(\n GetOrCreateChannelRequest(\n channel_name = \"CHANNEL-NAME\",\n )\n )\n```\n\n### Update channel\n\n```py\nfrom uuid import UUID\nfrom web_suck_it_py import UpdateChannelRequest\nfrom web_suck_it_py import Channel\nchannel: Channel = handler.update_channel(\n UpdateChannelRequest(\n # set to channel id\n channel_id=UUID(\"\"),\n regenerate_pass_key=False,\n # set `channel` to change channel name\n channel=\"change-channel-name\",\n # set `max_connections` to change maximum concurrent connections\n max_connections=5,\n )\n )\n```\n\n### Delete channel\n\n```py\nfrom uuid import UUID\nfrom web_suck_it_py import DeleteChannelRequest\nhandler.delete_channel(\n DeleteChannelRequest(\n channel_id=UUID(\"\"),\n )\n)\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for WebSuckIt integration",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://websuckit.com",
"Repository": "https://github.com/WebSuckIt/web-suck-it-py"
},
"split_keywords": [
"websocket",
"communication",
"http",
"websuckit",
"realtime"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5aadc89a9dbcfbcdd3a17cf6400af94871318cc12998bb032cc2d551097e4562",
"md5": "dcd23b7a3ef68eb32fba30e59ef281db",
"sha256": "05d890cc608d5a2e6531a9e8a3d7fc8ddfca65cb8aaf3de5be98679c9cf96e74"
},
"downloads": -1,
"filename": "web_suck_it_py-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dcd23b7a3ef68eb32fba30e59ef281db",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0.0",
"size": 10230,
"upload_time": "2023-11-16T00:35:17",
"upload_time_iso_8601": "2023-11-16T00:35:17.867233Z",
"url": "https://files.pythonhosted.org/packages/5a/ad/c89a9dbcfbcdd3a17cf6400af94871318cc12998bb032cc2d551097e4562/web_suck_it_py-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e2bc4d460b0aee141acb2c444316463aa3868fea184dbd7d24f29ace58807121",
"md5": "b8dadea3aef2bd7492166604437a9e6d",
"sha256": "26ad6c20146cf571cfdca0959091cb6af46591b80adade886b128348160bd4cd"
},
"downloads": -1,
"filename": "web_suck_it_py-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "b8dadea3aef2bd7492166604437a9e6d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0.0",
"size": 6880,
"upload_time": "2023-11-16T00:35:19",
"upload_time_iso_8601": "2023-11-16T00:35:19.359570Z",
"url": "https://files.pythonhosted.org/packages/e2/bc/4d460b0aee141acb2c444316463aa3868fea184dbd7d24f29ace58807121/web_suck_it_py-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-16 00:35:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WebSuckIt",
"github_project": "web-suck-it-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "web-suck-it-py"
}