Introduction
A Python module for managing Cloud Variables.
IMPORTANT NOTES
Since this module is built upon the package upstash-redis, you MUST visit the website right here to create tokens and the link that are nessecary for the following examples.
Examples:
Example 1 for the CloudVar class.
import cloud_variables as cv
cloudvar = cv.CloudVar("https://apparent-gopher-******.upstash.io", "******") # Use the actual values here.
# Basic assignment
cloudvar["string"] = "Hello, World!"
# Retrieving values
print(cloudvar["string"]) # 'Hello, World!'
# Advanced mutable objects
cloudvar["list"] = [1, 2, 3]
cloudvar["list"].append(4)
print(cloudvar["list"]) # [1, 2, 3, 4]
# Deleting and popping items
cloudvar["key1"] = "value1"
cloudvar["key2"] = "value2"
del cloudvar["key1"] # Deleting keys.
value = cloudvar.pop("key2") # Popping keys
print(value) # 'value2'
# Some more methods
# Retrieving Python key-value pairs as dictionaries
print(cloudvar.items()) # {'string': 'Hello, World!', 'list': [1, 2, 3, 4]}
# Clearing everything
cloudvar.clear()
print(cloudvar.items()) # {}
Example 2 for the class AsyncCloudVar.
import cloud_variables as cv
import asyncio
async def main(): # Use asynchronous functions for full functionality access.
async_cloudvar = cv.AsyncCloudVar("https://apparent-gopher-******.upstash.io", "******") # Use your actual values again.
async_cloudvar.start()
# Basic assignment
async_cloudvar["string"] = "Hello, World!"
# Retrieving values
print(async_cloudvar["string"]) # 'Hello, World!'
# Advanced mutable objects
async_cloudvar["list"] = [1, 2, 3]
async_cloudvar["list"].append(4)
print(async_cloudvar["list"]) # [1, 2, 3, 4]
# Deleting and popping items
async_cloudvar["key1"] = "value1"
async_cloudvar["key2"] = "value2"
del async_cloudvar["key1"] # Deleting keys.
value = await async_cloudvar.pop("key2") # Popping keys
print(value) # 'value2'
# Some more methods
# Retrieving Python key-value pairs as dictionaries
print(await async_cloudvar.items()) # {'string': 'Hello, World!', 'list': [1, 2, 3, 4]}
# Clearing everything
await async_cloudvar.clear()
print(await async_cloudvar.items()) # {}
asyncio.run(main())
Installation
You can easily install the module by typing the command:
pip install cloud-python-vars
Metadata
Release files for cloud-python-vars 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cloud_python_vars-0.1.2.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cloud_python_vars-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.1 kB
Release files / cloud_python_vars-0.1.2.tar.gz
| Download URL | cloud_python_vars-0.1.2.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ae835c5652e58b5212f90ef0b4f39a04a6b166c41463335210bc44a002e3ee9
|
|
BLAKE2b-256 checksum How to use checksums |
fdcf8bd0a0f6c10d9d969eb7e7ad94d70840c968bddd8a89218e9f01cf30156f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / cloud_python_vars-0.1.2-py3-none-any.whl
| Download URL | cloud_python_vars-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
339949604b398789ae899cfcf58ce67f9092253fe3114798f3cda185bb3f0e1c
|
|
BLAKE2b-256 checksum How to use checksums |
8be066981c41b064fb70cd2ead342ae0e201c0d586d2df77b6547afdbfc448cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|