Skip to main content

Official Moncreneau API client for Python

Project description

Moncreneau Python SDK

Official Moncreneau API client for Python.

PyPI version Python versions License: MIT

Installation

pip install moncreneau

Quick Start

from moncreneau import Moncreneau

client = Moncreneau('mk_live_YOUR_API_KEY')

# Create an appointment
appointment = client.appointments.create(
    department_id='dept_123',
    date_time='2026-01-20T10:00:00',
    user_name='Jean Dupont',
    user_phone='+224621234567',
    user_email='jean.dupont@example.com'
)

print(appointment['id'])  # appt_abc123

Documentation

Full documentation available at: https://moncreneau-docs.vercel.app/docs/v1/sdks/python

Features

  • ✅ Full type hints support
  • ✅ Automatic error handling
  • ✅ Webhook signature verification
  • ✅ Comprehensive documentation
  • ✅ Python 3.7+ support

Usage

Configuration

client = Moncreneau(
    api_key='mk_live_...',
    base_url='https://mc.duckdns.org/api/v1',  # optional
    timeout=30  # optional, in seconds
)

Appointments

# Create
appointment = client.appointments.create(
    department_id='dept_123',
    date_time='2026-01-20T10:00:00',
    user_name='Jean Dupont',
    user_phone='+224621234567'
)

# List
appointments = client.appointments.list(
    page=0,
    size=20,
    status='SCHEDULED'
)

# Retrieve
appointment = client.appointments.retrieve('appt_abc123')

# Cancel
client.appointments.cancel('appt_abc123')

Departments

# List departments
departments = client.departments.list()

# Get availability
availability = client.departments.get_availability(
    'dept_123',
    start_date='2026-01-20',
    end_date='2026-01-27'
)

Error Handling

from moncreneau import Moncreneau, MoncreneauError

try:
    appointment = client.appointments.create(...)
except MoncreneauError as error:
    print(f'Code: {error.code}')
    print(f'Message: {error.message}')
    print(f'Status: {error.status_code}')
    print(f'Details: {error.details}')

Webhooks

from moncreneau import Moncreneau

# In your Flask/Django/FastAPI endpoint
@app.route('/webhooks/moncreneau', methods=['POST'])
def webhook():
    signature = request.headers.get('X-Webhook-Signature')
    
    is_valid = Moncreneau.verify_webhook_signature(
        request.json,
        signature,
        os.getenv('WEBHOOK_SECRET')
    )
    
    if not is_valid:
        return 'Invalid signature', 401
    
    # Process webhook
    event = request.json
    print(f"Event type: {event['type']}")
    
    return 'OK', 200

Examples

Flask Application

from flask import Flask, request, jsonify
from moncreneau import Moncreneau, MoncreneauError
import os

app = Flask(__name__)
client = Moncreneau(os.getenv('MONCRENEAU_API_KEY'))

@app.route('/appointments', methods=['POST'])
def create_appointment():
    try:
        appointment = client.appointments.create(
            department_id=request.json['departmentId'],
            date_time=request.json['dateTime'],
            user_name=request.json['userName'],
            user_phone=request.json['userPhone']
        )
        return jsonify(appointment)
    except MoncreneauError as error:
        return jsonify({
            'error': error.code,
            'message': error.message
        }), error.status_code

Django View

from django.http import JsonResponse
from moncreneau import Moncreneau, MoncreneauError
import json
import os

client = Moncreneau(os.getenv('MONCRENEAU_API_KEY'))

def create_appointment(request):
    try:
        data = json.loads(request.body)
        appointment = client.appointments.create(
            department_id=data['departmentId'],
            date_time=data['dateTime'],
            user_name=data['userName'],
            user_phone=data['userPhone']
        )
        return JsonResponse(appointment)
    except MoncreneauError as error:
        return JsonResponse({
            'error': error.code,
            'message': error.message
        }, status=error.status_code)

Support

License

MIT © Moncreneau

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

moncreneau-1.0.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

moncreneau-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file moncreneau-1.0.0.tar.gz.

File metadata

  • Download URL: moncreneau-1.0.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for moncreneau-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8ebdbc2a17c61fb5675b025201e313abf16f1d75c31d7c977e45bc2fe9fa509b
MD5 2b504645a6d18807917f31f80a599cef
BLAKE2b-256 dc4978a84a57af030e4754d9382cf9c3b69bc013bb1faf8327e8226dd2b87734

See more details on using hashes here.

File details

Details for the file moncreneau-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: moncreneau-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for moncreneau-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7812614747ba1dd112d68279279d498b08f03282953a631ec86d9e9b263811aa
MD5 2858cf004349d4f0d44c5c8d9e58c63f
BLAKE2b-256 fb3b908fed69becf8f5abcc839288bcefb0bb75b29dab610457a305fcfe72787

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