Skip to main content

Simple package for managing partner availability configurations across tenants

Project description

Partner Availability Configuration

Simple Python package for managing partner availability configurations across tenants.

Installation

pip install partner-availability-config

Usage

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from partner_availability import PartnerAvailabilityService, Base

# Setup your database connection
engine = create_engine("postgresql://user:pass@localhost/db")
Base.metadata.create_all(engine)
SessionLocal = sessionmaker(bind=engine)

# Initialize service
service = PartnerAvailabilityService(get_session=SessionLocal)

# Use the 3 core methods
# 1. Get enabled partners
partners = service.get_enabled_partners("tenant1")

# 2. Check if partner is active
is_active = service.is_partner_active("tenant1", "partner_a")

# 3. Update configuration
service.update_partner_config("tenant1", {
    "enabled_partners": ["partner_a", "partner_b"],
    "is_active": True,
    "api_key": "your_api_key"
})

Database Schema

The package creates a partner_availability_config table:

  • tenant (VARCHAR, PRIMARY KEY) - Tenant identifier
  • is_active (BOOLEAN) - Whether configuration is active
  • api_key (VARCHAR) - API key for tenant
  • enabled_partners (JSON) - List of enabled partner identifiers

Methods

get_enabled_partners(tenant: str) -> List[str]

Returns list of enabled partner identifiers for a tenant.

is_partner_active(tenant: str, partner_id: str) -> bool

Returns True if partner is active for the tenant.

update_partner_config(tenant: str, config_data: Dict) -> None

Updates or creates partner configuration for a tenant.

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

partner_availability_config-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

partner_availability_config-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file partner_availability_config-0.1.1.tar.gz.

File metadata

File hashes

Hashes for partner_availability_config-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e26f8687d49db9c74b0dc81bb76e904ad9cfaff8ba42e3661e64a506f70ed09e
MD5 dc64ea4df7c3b7b3e8feb754ddb69bd8
BLAKE2b-256 1a1aeb2443b034bdd2b14188ab8314c856faed9e73a1905e04a47015f16c317a

See more details on using hashes here.

File details

Details for the file partner_availability_config-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for partner_availability_config-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a63cec6b738f4472bec73111325a12107dfeaf0db35ce7d3d2a861299fd33467
MD5 ec356408f873c1a137914b6809930494
BLAKE2b-256 1a56862b2f65023dcfb2fae39a2449d33a0b8215acc6f93ca6022c30b82e6ac7

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