Pyswit: Python + Swit.io
Python interface for Swit.io RESTful API
Requirements
This library requires Python 3.6 or later.
Installation
$ pip install pyswit
Authentication
- You need
access tokento use Swit Open API. - Please refer Getting started with authentication
Examples
from pyswit import Pyswit
access_token = "<your access token>"
swit = Pyswit(access_token)
# User
print(swit.user.info())
# Create a message
channel_id = "<your_channel_id>" # not channel name
response = swit.message.create(channel_id=channel_id, content="Hello, World!")
# Get message_id
message_id = response["data"]["message"]["message_id"]
# React to a message
swit.message.reaction.create(message_id=message_id, reaction_name=":smile:")
# Comment on a message
swit.message.comment.create(message_id=message_id, content="Comment string here")
Webhook
Pyswit supports webhook.
Webhook API does not require access token
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' <your_webhook_url>
The above curl request can be implemented with pyswit as follows.
from pyswit.webhook import webhook
webhook_url="<your_webhook_url>"
webhook(url=webhook_url, text="Hello, World!")
Documentation
Swit.io Developer documentation
- Currently, Pyswit supports the following API.
| HTTP | endpoint | pyswit | |
|---|---|---|---|
| Users | GET | user.info | ✅ |
| Workspaces | GET | workspace.info | ✅ |
| GET | workspace.list | ✅ | |
| POST | workspace.update | ✅ | |
| GET | workspace.user.info | ✅ | |
| GET | workspace.user.list | ✅ | |
| POST | workspace.user.update | ✅ | |
| Channels | POST | channel.archive | ✅ |
| POST | channel.create | ✅ | |
| POST | channel.createDirect | ✅ | |
| GET | channel.info | ✅ | |
| GET | channel.list | ✅ | |
| POST | channel.update | ✅ | |
| Messages | POST | message.comment.create | ✅ |
| GET | message.comment.list | ✅ | |
| POST | message.comment.remove | ✅ | |
| POST | message.create | ✅ | |
| GET | message.info | ✅ | |
| GET | message.list | ✅ | |
| POST | message.reaction.create | ✅ | |
| POST | message.reaction.remove | ✅ | |
| POST | message.remove | ✅ | |
| Ideas | POST | idea.comment.create | ✅ |
| GET | idea.comment.list | ✅ | |
| POST | idea.comment.remove | ✅ | |
| POST | idea.create | ✅ | |
| GET | idea.info | ✅ | |
| GET | idea.list | ✅ | |
| POST | idea.remove | ✅ | |
| POST | idea.reaction.create | ✅ | |
| POST | idea.reaction.remove | ✅ | |
| Projects | POST | project.archive | ✅ |
| POST | project.create | ✅ | |
| GET | project.info | ✅ | |
| GET | project.list | ✅ | |
| GET | project.tagList | ✅ | |
| POST | project.update | ✅ | |
| GET | project.user.list | ✅ | |
| Project buckets | POST | project.bucket.create | ✅ |
| GET | project.bucket.info | ✅ | |
| GET | project.bucket.list | ✅ | |
| POST | project.bucket.update | ✅ | |
| Tasks | POST | task.assignee.add | ✅ |
| POST | task.asignee.remove | ✅ | |
| POST | task.checklist.create | ✅ | |
| GET | task.checklist.info | ✅ | |
| GET | task.checklist.list | ✅ | |
| POST | task.checklist.remove | ✅ | |
| POST | task.checklist.update | ✅ | |
| POST | task.comment.create | ✅ | |
| GET | task.comment.list | ✅ | |
| POST | task.comment.remove | ✅ | |
| POST | task.comment.update | ✅ | |
| POST | task.create | ✅ | |
| POST | task.follow.add | ✅ | |
| POST | task.follow.remove | ✅ | |
| GET | task.info | ✅ | |
| GET | task.list | ✅ | |
| GET | task.listByColumn | ✅ | |
| POST | task.move | ✅ | |
| GET | task.myTaskList | ✅ | |
| POST | task.remove | ✅ | |
| POST | task.update | ✅ | |
| Posts | ❌ | ||
| Boards | ❌ | ||
| Custom fileds | ❌ | ||
| Approvals | ❌ |
- Advanced Only API:
Posts,Boards,Custom fileds,Approvals - Pyswit has no plan to support Advanced Only API
Metadata
Release files for pyswit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyswit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyswit-1.0.0-py3-none-any.whl |
Release files / pyswit-1.0.0-py3-none-any.whl
| Download URL | pyswit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
307e31c28fae9e194e9d5882a784c818b4ab215e524434c90cc0b0d9f97cbe4b
|
|
BLAKE2b-256 checksum How to use checksums |
0f75f577347534ac0376d5273aa7ebc5f7a93f3b4ed12d94e95eb1d4a462131b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for pyswit 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.