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.1.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.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8e8a53e2356b32166bb8f8b95d1dbfd5134c43ff022d2528db9bd33bc1e2a475
MD5 61fc849b84efc68a5bcb680d8e6c8586
BLAKE2b-256 4319d12b54a53ec8593324c1591ed8cef8a4aeca77c9f8a2096f72e63b324824

See more details on using hashes here.

File details

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

File metadata

  • Download URL: monapi_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84b138e334f9e61d0215cac692db9392c8c99252ffb1dec3c515330859cad5ea
MD5 91d3662dd7b207099ff37dee6db29cf7
BLAKE2b-256 22ba1fc7a575161341c881b11af840ea9334b55faef5a94a4b9182810d3ad7e0

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