Skip to main content

SDK for integrating with the Monapi Marketplace

Project description

Monapi SDK for Python

This SDK allows providers to easily integrate with the Monapi Marketplace.

Installation

pip install monapi-sdk

Usage

from fastapi import FastAPI, Request
from monapi import MarketplaceProvider
import os

app = FastAPI()

# Initialize the marketplace provider with your secret key
marketplace = MarketplaceProvider(
    provider_secret=os.getenv("MARKETPLACE_SECRET"),
)

# Add the marketplace middleware to validate incoming requests
@app.middleware("http")
async def marketplace_middleware(request: Request, call_next):
    return await marketplace.validate_request_middleware(request, call_next)

# Create your API endpoints
@app.post("/api/webhook")
async def handle_webhook(request: Request):
    # The request has already been validated by the middleware
    # You can now process the webhook
    data = await request.json()
    return {"status": "success", "data": data}

Features

  • Request validation using HMAC-SHA256 signatures
  • FastAPI middleware for easy integration
  • Automatic timestamp validation
  • Detailed logging for debugging

Requirements

  • Python 3.7+
  • FastAPI

License

MIT

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

monapi_sdk-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

monapi_sdk-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file monapi_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: monapi_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for monapi_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 695f2f7d5c602f41089953618a7dbbeb519bbc30941226eff05fb2e77a67ef3c
MD5 012821bfa37665ff9a1cab84812efa06
BLAKE2b-256 6923ede6daab55d36618e530bea4e389955baca029312e719cb2186069d40a50

See more details on using hashes here.

File details

Details for the file monapi_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: monapi_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for monapi_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0f1a94008ab2b7f4104e23a4580d1c233cd9e03b4c86788cd5de47c43934ba3
MD5 632c16ee6859ddf78157ed6cb22c1297
BLAKE2b-256 d7043f59279022ba80fb20f5200cbed01b46dd9ecc352cec5561204b05f3abf3

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