Skip to main content

Swit.io API client

Project description

Pyswit: Python + Swit.io

Python interface for swit.io

PyPI PyPI download month PyPI format PyPI pyversions PyPI license


Requirements

This library requires Python 3.6 or later.

Installation

$ pip install pyswit

Examples

from pyswit import Pyswit

# How to get access token: https://developers.swit.io/documentation#authentication
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.

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 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 swit.user.info() :white_check_mark:
Workspaces [Advanced Only] No plan to support :x:
Channels POST channel.archive swit.channel.archive() :white_check_mark:
POST channel.create swit.channel.create() :white_check_mark:
POST channel.createDirect swit.channel.createDirect() :white_check_mark:
GET channel.info swit.channel.info() :white_check_mark:
GET channel.list swit.channel.list() :white_check_mark:
POST channel.update swit.channel.update() :white_check_mark:
Messages POST message.comment.create swit.message.comment.create() :white_check_mark:
GET message.comment.list swit.message.comment.list() :white_check_mark:
POST message.comment.remove swit.message.comment.remove() :white_check_mark:
POST message.create swit.message.create() :white_check_mark:
GET message.info swit.message.info() :white_check_mark:
GET message.list swit.message.list() :white_check_mark:
POST message.reaction.create swit.message.reaction.create() :white_check_mark:
POST message.reaction.remove swit.message.reaction.remove() :white_check_mark:
POST message.remove swit.message.remove() :white_check_mark:
Ideas
Projects POST project.archive
POST project.create
GET project.info
GET project.list swit.project.list() :white_check_mark:
GET project.tagList
POST project.update
GET project.user.list
Project buckets
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 swit.task.create() :white_check_mark:
POST task.follow.add
POST task.follow.remove
GET task.info swit.task.info() :white_check_mark:
GET task.list swit.task.list() :white_check_mark:
GET task.listByColumn swit.task.listByColumn() :white_check_mark:
POST task.move swit.task.move() :white_check_mark:
GET task.myTaskList swit.task.myTaskList() :white_check_mark:
POST task.remove swit.task.remove() :white_check_mark:
POST task.update swit.task.update() :white_check_mark:
Posts [Advanced Only] No plan to support :x:
Boards [Advanced Only] No plan to support :x:
Custom fileds
Approvals

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyswit-0.0.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pyswit-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyswit-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for pyswit-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8e03f178fe780c9e2d3c9835a2938c389eb9829098c0220190a17475d7e27c9c
MD5 31f8c2d28d0776f3409d18c5a9475e44
BLAKE2b-256 512d7c8e1b00b1cce327df7ac928dccebb80a496286d0f73964322f8d28d7a0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page