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.2.tar.gz (4.4 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.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 4.4 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.2.tar.gz
Algorithm Hash digest
SHA256 d57134ba26f37af4a505fb73c83c00278d38ba0d6c6a31dda138279cf8005526
MD5 e48d2e5a28390b5c02e5c972134a5571
BLAKE2b-256 f1e7537b724af5d8725b1acba4827582c388dd65c384d0eb44d6ae9b98af7244

See more details on using hashes here.

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 104f584cd4228d966ceb3369e3c893de73a9cad31cf50bfe61254b10cbd2d9e4
MD5 ca2487281ebf88c099adadf12488696d
BLAKE2b-256 d6160cf15157ba2e1026a9fbbafbdde042553a27625d1385ceabbc0824196ac4

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