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.4.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.

monapi_sdk-0.1.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 4.5 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.4.tar.gz
Algorithm Hash digest
SHA256 ec2c60aa2976686833977f726e56e5283ca3370ec6102a9470e0562c3cc8d41f
MD5 9dbfc31f8321b83edca7f0b1d45f1ed3
BLAKE2b-256 a25ce4a6d87d31a55f6e086ae828da7663661930452fd4a35c9224d3cd6b3880

See more details on using hashes here.

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 36903b4a384a98fbded4e43fd2dcf2c627841183e19be0fc4dd153a9dcae2c60
MD5 e0a400d45f65582fea554bb7dd22184f
BLAKE2b-256 82379be51bb5f24b4c29f0fd3266047c3c7c62bbbda73264d758d3414fa60c1c

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