Skip to main content

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:

  • NotAuthenticatedException
  • ValidationException
  • AlreadyExistsException
  • AfhException (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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abstract_framehub_client-0.1.5.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

abstract_framehub_client-0.1.5-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

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

Hashes for abstract_framehub_client-0.1.5.tar.gz
Algorithm Hash digest
SHA256 199dfeafcb9dbf85059e64c158d1862c30ce56993ff87bcac4633858a25238fc
MD5 5fe8ccfcbebddcfc544acfc5c4ba5793
BLAKE2b-256 c63966547bdab9775506e21def4989a761df3ae0044f4a63100ecd0812f2f883

See more details on using hashes here.

File details

Details for the file abstract_framehub_client-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for abstract_framehub_client-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 45972d7c583a514aadf9ba2e84bbe0affe7fec3270a37ea9973d5429689b3e77
MD5 9157ac4fb1b3d3fb8951eb9559718b2f
BLAKE2b-256 d4b98c156bb2cc673e9153a6d7a8590a7a03d148cfd97db95a5936473ddcd366

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