Skip to main content

API REST FactPulse

Reason this release was yanked:

Test

Project description

FactPulse SDK Python

Client Python officiel pour l'API FactPulse - Facturation électronique française.

🚀 Installation

pip install factpulse

📖 Quickstart

Authentification

from factpulse import ApiClient, Configuration

# Configuration
config = Configuration(host='https://api.factpulse.fr')
config.access_token = 'votre_token_jwt'

# Créer le client API
client = ApiClient(configuration=config)

Générer une facture Factur-X

from factpulse.api.traitement_facture_api import TraitementFactureApi
from factpulse.models.facture_factur_x import FactureFacturX

api = TraitementFactureApi(client)

# Préparer les données de facture
facture = {
    "numero_facture": "FAC-2025-001",
    "date_emission": "2025-01-15",
    "montant_total_ht": 1000.00,
    "montant_total_ttc": 1200.00,
    "fournisseur": {
        "nom": "Mon Entreprise",
        "siret": "12345678901234",
        "adresse": "123 Rue Example, 75001 Paris"
    },
    "client": {
        "nom": "Client SARL",
        "siret": "98765432109876",
        "adresse": "456 Avenue Test, 69001 Lyon"
    }
}

# Générer la facture Factur-X
response = api.api_v1_traitement_generer_facturx_post(
    body=facture,
    profil='EN16931',
    format='pdf'
)

# Sauvegarder le PDF
with open('facture.pdf', 'wb') as f:
    f.write(response)

Soumettre une facture AFNOR PDP

from factpulse.api.afnor_pdppa_flow_service_api import AFNORPDPPAFlowServiceApi

afnor_api = AFNORPDPPAFlowServiceApi(client)

# Soumettre un flux
response = afnor_api.api_v1_afnor_flow_v1_flows_post(
    body={
        "name": "Facture FAC-2025-001",
        "flow_syntax": "CII",
        "flow_profile": "EN16931",
        "flow_content_base64": "...",  # Contenu XML en base64
        "pdp_credentials": {
            "flow_service_url": "https://pdp.example.fr/flow/v1",
            "token_url": "https://auth.example.fr/oauth/token",
            "client_id": "your_client_id",
            "client_secret": "your_client_secret"
        }
    }
)

print(f"✅ Flux soumis : {response.flow_id}")

Rechercher une entreprise avec Chorus Pro

from factpulse.api.chorus_pro_api import ChorusProApi

chorus_api = ChorusProApi(client)

# Rechercher une entreprise
response = chorus_api.api_v1_chorus_pro_recherche_entreprise_post(
    body={
        "identifiant_structure": "12345678901234",
        "type_identifiant_structure": "SIRET"
    }
)

print(f"Entreprise trouvée : {response.nom}")

📚 Documentation complète

🔑 Obtenir un token JWT

Via API (automatisation)

import requests

response = requests.post(
    'https://www.factpulse.fr/api/token/',
    json={
        'username': 'votre_email@example.com',
        'password': 'votre_mot_de_passe'
    }
)

access_token = response.json()['access']

Via Dashboard (interface web)

  1. Connectez-vous sur https://www.factpulse.fr/dashboard/
  2. Cliquez sur "Generate Test Token" ou "Generate Production Token"
  3. Copiez le token généré

🛠️ Configuration avancée

Timeout personnalisé

config = Configuration(host='https://api.factpulse.fr')
config.access_token = 'votre_token'

# Timeout de 60 secondes
client = ApiClient(configuration=config)
client.rest_client.pool_manager.connection_pool_kw['timeout'] = 60

Proxy HTTP

config = Configuration(host='https://api.factpulse.fr')
config.proxy = 'http://proxy.example.com:8080'

Mode debug

import logging

# Activer les logs debug
logging.basicConfig(level=logging.DEBUG)

🧪 Tests

# Installer les dépendances de test
pip install -e ".[test]"

# Lancer les tests
pytest tests/

📄 License

MIT License - voir LICENSE

🆘 Support

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

factpulse-1.0.1.tar.gz (147.3 kB view details)

Uploaded Source

Built Distribution

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

factpulse-1.0.1-py3-none-any.whl (475.1 kB view details)

Uploaded Python 3

File details

Details for the file factpulse-1.0.1.tar.gz.

File metadata

  • Download URL: factpulse-1.0.1.tar.gz
  • Upload date:
  • Size: 147.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for factpulse-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7582c4f40ffef6f9c7712061f56ded34d5b6ba00dc693fdbe1e897c3f1a0c06f
MD5 871ff0364866470d4e049f59c3bbe125
BLAKE2b-256 a4cf03c11fcf1addfd26d6bf416ae6060861e6ff5c29e8b030f2629ee0b2f924

See more details on using hashes here.

File details

Details for the file factpulse-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: factpulse-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 475.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for factpulse-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10218125ce809c8c60590bed7d7bc10f7576f86bcd7e0c3fc5e00fd264d5fe41
MD5 050a367d2e24239695d2312864a8c862
BLAKE2b-256 ffcba7033efe3e716caeaccb8c081ce6a9c01b0ee29d767691425e5ad26a3e68

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