Skip to main content

Vestaboard client library

Project description

Vesta

Vesta is a Vestaboard client library for Python. It provides an API client and character-encoding utilities.

Installation

Vesta requires Python 3.6 or later. It can be installed via PyPI:

$ python -m pip install vesta

It's only runtime dependency is the Requests library, which will be installed automatically.

Usage

API Client

The Client type is initialized with an API key and secret:

>>> import vesta
>>> client = vesta.Client(API_KEY, API_SECRET)

Then, you can make API calls using one of the provided methods:

>>> client.get_viewer()
{'_id': ..., '_created': '1629081092624', 'type': 'installation', 'installation': {'_id': ...}}

>>> client.get_subscriptions()
[{'_id': ..., '_created': '1629081092624', 'title': None, 'icon': None, 'installation': {'_id': ..., 'installable': {'_id': ...}}, 'boards': [{'_id': ...}]}]

>>> client.post_message(SUBSCRIPTION_ID, "Hello, World")
{'message': {'id': ..., 'text': 'Hello, World', 'created': '1635801572442'}}

Character Encoding

All Vestaboard characters (letters, numbers, symbols, and colors) are encoded as integer character codes. Vesta includes some useful routines for working with these character codes.

encode(s) encodes a string as a list of character codes. In addition to printable characters, the string can contain character code sequences inside curly braces, such as {5} or {65}.

>>> vesta.encode("{67} Hello, World {68}")
[67, 61, 8, 5, 12, 12, 15, 55, 61, 23, 15, 18, 12, 4, 61, 68]

encode_row(s) encodes a string as a row of character codes. It builds on encode(s) by providing alignment control.

>>> vesta.encode_row("{67} Hello, World {68}", align="center")
[0, 0, 0, 67, 61, 8, 5, 12, 12, 15, 55, 61, 23, 15, 18, 12, 4, 61, 68, 0, 0, 0]

Lastly, pprint() can be used to pretty-print encoded characters to the console, which can be useful during development.

>>> vesta.pprint([0, 0, 0, 67, 61, 8, 5, 12, 12, 15, 55, 61, 23, 15, 18, 12, 4, 61, 68, 0, 0, 0])
| | | |◼︎| |H|E|L|L|O|,| |W|O|R|L|D| |◼︎| | | |

Message Posting

Messages can be posted as either text strings or two-dimensional arrays of character codes representing the exact positions of characters on the board.

If text is specified, lines will be centered horizontally and vertically if possible. Character codes will be inferred for alphanumeric and punctuation, or can be explicitly specified in-line in the message with curly braces containing the character code.

License

This project is licensed under the terms of the MIT license.

Copyright (c) 2021 Jon Parise jon@indelible.org

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

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

Source Distribution

vesta-0.5.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

vesta-0.5.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file vesta-0.5.0.tar.gz.

File metadata

  • Download URL: vesta-0.5.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for vesta-0.5.0.tar.gz
Algorithm Hash digest
SHA256 cdc0107cf8a4acdf385af61773bfd050fa7ad9f07ca21a4ec55d6468def26f3f
MD5 ea85136b1355013cdaccc6ddc34aabed
BLAKE2b-256 545e98108b03da03f735927d655c744318eb9020a8ec4d099b93038161cb0bb1

See more details on using hashes here.

Provenance

File details

Details for the file vesta-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: vesta-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for vesta-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42ca36e45522f30f32470022433995a20ab70ad4f0ee0cea1ce6f7a7c456b32b
MD5 0b13a3974747cf71e493f8c33ac305c0
BLAKE2b-256 1f5228eb4af350a13db621447d3513a87f2d083fa1b8e660a888dcf732c96bff

See more details on using hashes here.

Provenance

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