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 .

Abstract Frame Hub Server :

git clone https://gitlab.com/stackngo-client/abstractframehub-helm.git
cd docker-compose
docker-compose up -d

🚀 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.6.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.6-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file abstract_framehub_client-0.1.6.tar.gz.

File metadata

  • Download URL: abstract_framehub_client-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 5f002575acb6cd62049ed16798fa7e2cdaf40d56650eeef70f7e6cdf84b6788f
MD5 e1883c48e3e148b807385378dcf7d1e0
BLAKE2b-256 b8bfb22eca4c1dafeeedf2e81392af65ce7a371c56b5cb58e82268c03ecc8756

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for abstract_framehub_client-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a8ffdcbe67be7e102619e3aa8cc2d585d910a9b516d09629a9afbe56216272c0
MD5 21e3080d1de10b856d4264c4e2777771
BLAKE2b-256 de80e2a7887be6ea4b0bfd607615ae2b59bef60a352a5c31b81701f6e7d6d364

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