Memfabric Hybrid Python API

1.0.8 · active · verified Fri Apr 17

The `memfabric-hybrid` library provides a Python API client for interacting with the Memfabric Hybrid data platform. It simplifies operations like endpoint management and data access within a hybrid cloud environment. The current version is 1.0.8, with releases appearing to be made as features are developed or bugs are fixed, indicating an active development status.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes the `MemfabricClient` which relies on `MEMFABRIC_API_KEY` and `MEMFABRIC_API_URL` environment variables for configuration. It then demonstrates fetching available endpoints. Remember to set your environment variables before running.

import os
from memfabric_hybrid.client import MemfabricClient
from memfabric_hybrid.exceptions import AuthError, APIError

# Configure API credentials and URL using environment variables
# For example:
# export MEMFABRIC_API_KEY="your_api_key_here"
# export MEMFABRIC_API_URL="https://api.memfabric.com"

# Ensure environment variables are set for a successful connection
api_key = os.environ.get('MEMFABRIC_API_KEY', '')
api_url = os.environ.get('MEMFABRIC_API_URL', '')

if not api_key or not api_url:
    print("Warning: MEMFABRIC_API_KEY and MEMFABRIC_API_URL environment variables are not set.")
    print("Please set them to run this example successfully.")
else:
    try:
        client = MemfabricClient()
        print("MemfabricClient initialized successfully.")
        
        # Example: List available endpoints
        endpoints = client.get_endpoints()
        print(f"Available endpoints: {endpoints}")
        
    except AuthError as e:
        print(f"Authentication error: {e}. Check your API key.")
    except APIError as e:
        print(f"Memfabric API error: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

view raw JSON →