Skip to main content

Python client library for the Odyssey Momentum platform.

Project description

Odyssey Momentum

Python library to interact with the Odyssey momentum platform.

PyPI - Version PyPI - Python Version


:warning: Work in progress, API of this library has not been stablized.


Table of Contents

Installation

Prerequisites

  • Python 3.10 or 3.11
  • x86_64 platform (for now, a c extension is used, not build for other platforms yet)
pip install --pre odyssey-momentum

(pre, since it is still in development)

Usage

The python package contains 3 parts:

  • api - To access the JSON, REST-like API.
  • posbus - To connect throurh websocket and receive real times updates.
  • bot - A higher level library build on top of these, providing functionality to build bots.

Library is build around python async/await functionality, particulary async context managers and async generators. So needs to be used with either asyncio or trio.

Example

Run from an asyncio shell:

python -m asyncio

Example API call:

from odyssey_momentum import api, posbus

url = "https://dev.odyssey.ninja"
auth = await posbus.authenticate_guest(url, cache=False)
client = api.API(url, auth["token"])
me = await client.current_user()
print(me.name)

Example websocket connection:

from odyssey_momentum import posbus

url = "https://dev.odyssey.ninja"
auth = await posbus.authenticate_guest(url, cache=False)
async with posbus.connect(url, auth) as (send, stream):
  await send(posbus.teleport_request("00000000-0000-8000-8000-000000000002"))
  async for msg in stream:
    print(msg)

See examples directory for more

Development

Project is managed with hatch.

To get a shell for development:

hatch shell

Run tests:

hatch run test

Run code lint:

hatch run lint:all
hatch build --hooks-only

Build packages (outputs in dist directory:

hatch build

License

odyssey-momentum is distributed under the terms of the MIT license.

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

odyssey_momentum-0.0.1a2.tar.gz (732.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odyssey_momentum-0.0.1a2-py3-none-any.whl (262.2 kB view details)

Uploaded Python 3

File details

Details for the file odyssey_momentum-0.0.1a2.tar.gz.

File metadata

  • Download URL: odyssey_momentum-0.0.1a2.tar.gz
  • Upload date:
  • Size: 732.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for odyssey_momentum-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 a1ebe0a46a9ae6da64231daea08625bd1fe226f2eee5a692fbf203760b621cdb
MD5 11839c26680ebb2e59775981542a06ab
BLAKE2b-256 71f7e834902b1d8366023107bfb3e209c445bc5255b029ba1fafe18f2de67e7b

See more details on using hashes here.

File details

Details for the file odyssey_momentum-0.0.1a2-py3-none-any.whl.

File metadata

File hashes

Hashes for odyssey_momentum-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 f76e7d78b1e4695ebde0c89215f3659934399db15f8a0a64a6a9dc60f1e6c4f9
MD5 d8c50f288e8ccb76ea69d31adde75df5
BLAKE2b-256 3332df8c8d3c960d1dacb78b308770ec399fc194c91b8c52f9eda0d86c44de03

See more details on using hashes here.

Supported by

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