Python client for Obscura
Project description
Obscura Client For Python
Using the obscura-client Library
This guide will walk you through the steps to install and use the obscura-client library in Python, and provide examples on how to handle errors and deserialize responses using json.
Installation
First, install the obscura-client using pip:
pip install obscura-client
Usage
Make sure to import the necessary modules in your Python script:
from obscura_client import Client, ConfigMap
Here's an example demonstrating how to use the Client and ConfigMap:
def main():
url = "http://localhost:9797"
token = "your token here"
client = Client(url, token)
config_map = ConfigMap(client)
# Reading a key
try:
data = config_map.read("your path here")
print(f"Deserialized JSON: {data}")
except Exception as e:
print(f"Failed to deserialize JSON: {e}")
# Reading a key prefix
try:
data = config_map.read_with_prefix("your path prefix here")
print(f"Deserialized JSON with prefix: {data}")
except Exception as e:
print(f"Failed to deserialize JSON with prefix: {e}")
if __name__ == "__main__":
main()
Error Handling
The example above includes error handling for:
- Failed HTTP requests
- Deserialization errors
- Missing keys
Ensure that you handle these errors appropriately in your application to maintain robustness.
Additional Resources
For more information, refer to the server project repository here.
This guide offers a basic understanding of using the obscura-client library. For more complex scenarios, consider exploring the library documentation and source code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obscura_client-0.1.0.tar.gz.
File metadata
- Download URL: obscura_client-0.1.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f3196d5b4e74a72da5b1e6a6e01541c754df14adb56e23a3021fa08ef066f52
|
|
| MD5 |
55cbeff9e057d09b24ff0b73f85071c6
|
|
| BLAKE2b-256 |
357c9957df4c44119c024fa7ebfbeed296cb8adc8546e46faa171ba08574056f
|
File details
Details for the file obscura_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: obscura_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3063eab8d1d6765c29df1a66b66189706da2a0d84b4c3675a0385001e37f509e
|
|
| MD5 |
a678b104c045e6b324157352cb2f7239
|
|
| BLAKE2b-256 |
643050b3e232ba3b8789753692342fd3ba81ed86e196b9340596c4d56fd8a862
|