Skip to main content

HTTPState, httpstate.com

Project description

httpstate (python)

Quick Start

Install

pip install httpstate

Import

import httpstate

Pick any valid UUID v4. You can generate one here.

We'll use 45fb3654-0e92-44da-aa21-ca409c6bdab3 or 45fb36540e9244daaa21ca409c6bdab3 (without dashes).

Store some data with

httpstate.set('45fb36540e9244daaa21ca409c6bdab3', 'Hi! 👋🏻')

and retrieve it with

data = httpstate.get('45fb36540e9244daaa21ca409c6bdab3')

You can also get realtime updates

hs = httpstate.HttpState('45fb36540e9244daaa21ca409c6bdab3')

hs.on('change', lambda data: print(f'This will change everytime data is set [{data}].'))

That's it! 🐙

API

Functions

  • get(uuid) Get state of UUIDv4. Returns None|str.

  • message.unpack(bytes) Unpack binary WebSocket message into MessageType(uuid, timestamp, type, value).

  • post(uuid, data=None) Alias for set. Returns None|int.

  • put(uuid, data=None) Alias for set. Returns None|int.

  • read(uuid) Alias for get.

  • set(uuid, data=None) Set state of UUIDv4. Returns None|int. If data is None, defaults to ''.

  • write(uuid, data=None) Alias for set.

HttpState Class

  • HttpState(uuid) Create a reactive state instance of UUIDv4.
  • <HttpState>.data Property with the most up-to-date state value.

  • <HttpState>.get() Get state. Returns None|str.
  • <HttpState>.post(data=None) Alias for set.
  • <HttpState>.put(data=None) Alias for set.
  • <HttpState>.read() Alias for get.
  • <HttpState>.set(data=None) Set state. Returns None|int. If data is None, defaults to ''.
  • <HttpState>.write(data=None) Alias for set.

  • <HttpState>.off(type, callback) Unsubscribe from realtime updates.
  • <HttpState>.on(type, callback) Subscribe to realtime updates.
    • change: fired when state data changes. Callback receives current data as argument.

  • <HttpState>.delete() Cleanup and delete the instance.

About

Alex Morales, moralestapia.com

Copyright © Alex Morales, 2026

Contact

Comments, feature requests, etc. are welcome at inbox @ httpstate.com.

License

Unless otherwise stated in particular files or directories, this software is free software.

You can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

See LICENSE for more information.

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

httpstate-0.0.20.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

httpstate-0.0.20-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file httpstate-0.0.20.tar.gz.

File metadata

  • Download URL: httpstate-0.0.20.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for httpstate-0.0.20.tar.gz
Algorithm Hash digest
SHA256 62e550b08a5b174f0317c7ae4c9b78f8242167514b81cc424774482aa4441e47
MD5 f1ee1706d4370a254827bd06e6f4434e
BLAKE2b-256 8b757f0921b1bf8162920858837fb93bfe28e34fd0009d4ef2ae3e1dd48f7f49

See more details on using hashes here.

File details

Details for the file httpstate-0.0.20-py3-none-any.whl.

File metadata

  • Download URL: httpstate-0.0.20-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for httpstate-0.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 22f05eba60b9930c2fa7e6082f7b3c358100464442d85b2edf65c327eb6f049c
MD5 3b20b25c53adf60afdd6db7d8091ba83
BLAKE2b-256 fa18aa9f235dd64c57b11d4856089870e9a1e0ee04905c927e40a65c70a71c30

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