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=5,  # Integer: ID du département
    date_time='2026-01-20T10:00:00',
    name='Jean Dupont'  # Nom du bénéficiaire
)

print(appointment['id'])  # 123

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-prd.duckdns.org/api/v1',  # optional
    timeout=30  # optional, in seconds
)

Appointments

# Create
appointment = client.appointments.create(
    department_id=5,  # Integer: ID du département
    date_time='2026-01-20T10:00:00',
    name='Jean Dupont'  # Nom du bénéficiaire
)

# 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-2.0.2.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-2.0.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moncreneau-2.0.2.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-2.0.2.tar.gz
Algorithm Hash digest
SHA256 d22068d087d560c372a1bb4e26f8f4c96e1ee37b30192b631a12f59c72838df1
MD5 83957f71109b4094653f1a36dda657b9
BLAKE2b-256 919b5a8d9b6c0397841236efc08841fff7e8fb12f1eae55bf5ce2f4bb7b25cee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: moncreneau-2.0.2-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-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11fbd239453ce9acbba0c74e7f78fe977301cebf67d5c7e834b6144231ff0b53
MD5 b414e0ad350d647035040b60214e5e54
BLAKE2b-256 89cc7afbb35ff88003a49fe3ad7842f37684229bedd16a0b41fed8bbef3403db

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