Skip to main content
Latest PyPI version Number of PyPI downloads Test cone.tokens

This package provides a unique token generator for cone.app.

Features:

  • QR Code generation

  • JSON API for token management

Application ini file configuration

  • cone.tokens.config_file: Required. Path to tokens json config file.

  • cone.tokens.settings_node_path: Optional. Application node path to token settings node.

  • cone.tokens.entryfactory: Optional. Node class used as entry node factory.

JSON API

cone.tokens provides a JSON API for token management.

query_token

Query token by value. It expects a GET request.

Schema: URL/tokens/query_token

Params

  • value: A string containing the token value to look up.

Response

  • success: True or False.

  • token: Token data or null if token not exists.

  • message: On failure the error message is returned.

add_token

add_token is for generating a new token. It expects a POST request.

Schema: URL/tokens/add_token

Params

  • value: A string containing the token value. If empty, the token uuid gets used as value.

  • valid_from: A datetime in isoformat. If empty, token has no effective date.

  • valid_to: A datetime in isoformat. If empty, token has no expiration date.

  • usage_count: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times.

  • lock_time: Time in seconds the token is locked after consumption as integer.

Response

  • success: True or False.

  • token_uid: On success the token uid is returned.

  • message: On failure the error message is returned.

consume_token

consume_token is for consuming a token. It expects a GET request.

Schema: URL/tokens/<UUID>/consume_token

Params

  • No parametes expected.

Response

  • success: True or False.

  • consumed: On success flag whether token consumption was valid.

  • message: On failure the error message is returned.

update_token

edit_token is for editing a token. It expects a POST request.

Schema: URL/tokens/<UUID>/update_token

Params

  • value: A string containing the token value. If empty, the token uuid gets used as value. Unchanged if parameter is omitted.

  • valid_from: A datetime in isoformat. If empty, token has no effective date. Unchanged if parameter is omitted.

  • valid_to: A datetime in isoformat. If empty, token has no expiration date. Unchanged if parameter is omitted.

  • usage_count: An integer defining how often the token can be consumed. If -1, token can be consumed unlimited times. Unchanged if parameter is omitted.

  • lock_time: Time in seconds the token is locked after consumption as integer. Unchanged if parameter is omitted.

Response

  • success: True or False.

  • message: On failure the error message is returned.

delete_token

delete_token is for deleting a token. It expects a POST request.

Schema: URL/tokens/<UUID>/delete_token

Params

  • No parametes expected.

Response

  • success: True or False.

  • message: On failure the error message is returned.

TODO

  • Introduce consume permission for JSON API.

Contributors

  • Robert Niederreiter

  • Torben Baumgartner

  • Lena Daxenbichler

Changes

1.1.0 (2026-02-03)

  • Refactor package layout to use pyproject.toml and implicit namespace packages. [rnix]

0.5 (2024-05-23)

  • Update Makefile. [rnix]

  • properties and metadata of cone.tokens.model.Tokens are instance properties now. [rnix]

  • Use ts.http_request instead of ts.ajax.request. [rnix]

0.4 (2024-02-12)

  • Adopt Settings UI changes from cone.app. [rnix]

0.3 (2023-09-28)

  • Tokens can be bulk deleted. [lenadax]

  • Tokens can be created from scanned value. [rnix]

0.2 (2023-09-27)

  • Actually upload package to pypi. [rnix]

0.1 (2023-09-27)

  • Initial work. [rnix, toalba, lenadax]

License

MIT License

Copyright (c) 2023-2025, Cone Contributors

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.

Release files for cone.tokens 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cone.tokens 1.1.0
File Size Uploaded
cone_tokens-1.1.0.tar.gz 27.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cone.tokens 1.1.0
File Interpreter ABI Platform
cone_tokens-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.1 kB

Release files / cone_tokens-1.1.0.tar.gz

Download URL cone_tokens-1.1.0.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4806e9c7254952b9784db81cac201d2abb5d0304ac157fe116cf8323daf2a1a0
BLAKE2b-256 checksum
How to use checksums
d27307d8337747357b4ecb22160af92644b66b5c659fda71096f731ceaa7b82c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / cone_tokens-1.1.0-py3-none-any.whl

Download URL cone_tokens-1.1.0-py3-none-any.whl
Size 39.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06c63d728c44128afd3b2cdb9cd31ce02e2c9ae48a725cc317bcb9319911eb84
BLAKE2b-256 checksum
How to use checksums
0d18eb61f2cd117d3a8d092fc4031451b6f6e6b70f86e0192ef5f73e34c20ef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page