Client Python for AbstractFrameHub Server
Project description
Abstract Frame Hub Client
AbstractFrameHubClient is a Python client for interacting with AbstractFrameHub, a secure, schema-aware, and cloud-ready data layer inspired by MongoDB. It supports document validation, user and permission management, and future AI-enhanced data features.
📦 Installation
Install via PyPI:
pip install abstract-framehub-client
Or install from source:
git clone https://gitlab.com/stackngo-client/abstractframehub-client-python.git
cd abstractframehub-client-python
pip install .
🚀 Quick Start
from abstract-framehub-client import AbstractFrameHubClient
# Connect and authenticate
client = AbstractFrameHubClient()
client.login("root", "afh-password")
# Select a database and collection
db = client.database("mydb")
try:
db.create()
except AlreadyExistsException as e:
pass
collection = db.collection("mycollection")
# Insert a document
collection.insert_one({"title": "Hello, FrameHub!", "likes": 0})
# Query documents
results = collection.find({"likes": {"$gte": 0}})
print(results)
🔐 Authentication
client.login("root", "afh-password")
Stores a session token used automatically in future requests.
🗃️ Database & Collection API
db = client.database("blog")
db.create()
db.drop()
collection = db.collection("posts")
collection.insert_one({...})
collection.find_one({"key": "value"})
collection.delete_many({})
📐 Schema Support
Define and enforce JSON schemas per collection:
collection.schema({
"bsonType": "object",
"required": ["title", "content"],
"properties": {
"title": {"bsonType": "string"},
"content": {"bsonType": "string"}
},
"additionalProperties": False
})
👤 User Management
client.add_user({
"username": "admin",
"password": "securepass",
"permissions": {"blog": "*"}
})
client.drop_user("admin")
❗ Error Handling
All errors raise custom exceptions:
NotAuthenticatedExceptionValidationExceptionAlreadyExistsExceptionAfhException(generic)
🧪 Testing Example
def test_insert_and_find():
client = AbstractFrameHubClient()
client.login("admin", "123456")
db = client.database("testdb")
coll = db.collection("items")
doc_id = coll.insert_one({"name": "test item"})
result = coll.find_one({"_id": doc_id})
assert result["name"] == "test item"
📁 Project Structure
├── abstract_framehub_client
│ ├── __init__.py
│ ├── client.py
│ ├── exceptions.py
│ └── wrappers
│ ├── __init__.py
│ ├── collection.py
│ └── database.py
📝 License
This project is licensed under the MIT License.
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 abstract_framehub_client-0.1.5.tar.gz.
File metadata
- Download URL: abstract_framehub_client-0.1.5.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
199dfeafcb9dbf85059e64c158d1862c30ce56993ff87bcac4633858a25238fc
|
|
| MD5 |
5fe8ccfcbebddcfc544acfc5c4ba5793
|
|
| BLAKE2b-256 |
c63966547bdab9775506e21def4989a761df3ae0044f4a63100ecd0812f2f883
|
File details
Details for the file abstract_framehub_client-0.1.5-py3-none-any.whl.
File metadata
- Download URL: abstract_framehub_client-0.1.5-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45972d7c583a514aadf9ba2e84bbe0affe7fec3270a37ea9973d5429689b3e77
|
|
| MD5 |
9157ac4fb1b3d3fb8951eb9559718b2f
|
|
| BLAKE2b-256 |
d4b98c156bb2cc673e9153a6d7a8590a7a03d148cfd97db95a5936473ddcd366
|