Skip to main content

Python SDK for Imperio Utilities API — developer tools, Italian validators, FatturaPA, Secret Scanner, PDF processing, AI tools

Project description

Imperio API — Python SDK

PyPI version Python 3.8+ MIT License

Official Python SDK for Imperio Utilities — the developer tools platform for B2B automation.

Installation

pip install imperio-api

Quick Start

Get your API key at imperioutils.com/enterprise.

from imperio import ImperioClient

client = ImperioClient("empire_live_your_key_here")

Features

Secret Scanner — CI/CD ready

Detect exposed credentials before they hit production.

# Scan source code
result = client.scan_secrets(open("app.py").read(), filename="app.py")
print(result["risk_score"])      # CLEAN | LOW | MEDIUM | HIGH | CRITICAL
print(result["total"])           # number of findings
for f in result["findings"]:
    print(f["severity"], f["type"], f["line"], f["masked_value"])

Values are always masked in the response — safe to log.

Italian Validators (batch)

Validate CF, P.IVA, IBAN, CAP in a single call (up to 500 items).

result = client.validate_italian_batch([
    {"type": "cf",   "value": "RSSMRA85T10A562S"},
    {"type": "piva", "value": "12345678901"},
    {"type": "iban", "value": "IT60X0542811101000000123456"},
    {"type": "cap",  "value": "00100"},
])
print(result["valid_count"], "/", result["total"])

FatturaPA Parser

Parse Italian electronic invoices (SDI XML format, versions 1.2 and 1.3).

xml = open("fattura.xml").read()
result = client.parse_fattura_pa(xml)
print(result["cedente_prestatore"])      # seller info
print(result["cessionario_committente"]) # buyer info
for f in result["fatture"]:
    print(f["numero"], f["totale"])

GDPR Anonymization (batch)

Remove PII from text — regex-based, no AI, fully deterministic.

result = client.anonymize_batch(
    texts=["Mario Rossi, via Roma 1, mario@example.com"],
    level="standard"   # or "aggressive"
)
print(result["results"][0]["anonymized"])
# "[NOME] [NOME], [INDIRIZZO], [EMAIL]"

AI Tools

# Extract structured data from invoice text
invoice = client.extract_invoice_ai("Fattura n. 123 del 01/06/2026 ...")

# Analyze a contract for risks and clauses
analysis = client.analyze_contract(contract_text, language="it")

# Summarize long text
summary = client.summarize(text, style="bullets")  # brief | detailed | bullets

GitHub Actions CI/CD

Use the Secret Scanner template to scan every PR automatically:

- name: Install Imperio SDK
  run: pip install imperio-api

- name: Scan for secrets
  env:
    IMPERIO_API_KEY: ${{ secrets.IMPERIO_API_KEY }}
  run: python -c "
    from imperio import ImperioClient
    import os, sys
    client = ImperioClient(os.environ['IMPERIO_API_KEY'])
    result = client.scan_secrets(open('app.py').read())
    if result['critical'] > 0: sys.exit(1)
  "

Error Handling

from imperio.exceptions import ImperioError, AuthenticationError, InsufficientCreditsError

try:
    result = client.scan_secrets(code)
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError:
    print("Top up credits at imperioutils.com/billing")
except ImperioError as e:
    print(f"API error {e.status_code}: {e}")

Authentication

All requests use X-API-Key header. Keys follow the empire_live_* format and are managed at imperioutils.com/enterprise.

Links

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

imperio_api-1.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

imperio_api-1.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file imperio_api-1.1.0.tar.gz.

File metadata

  • Download URL: imperio_api-1.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for imperio_api-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9d8da2d6875dec08b05fb670e77d44a1f55cab8b633d9fe6ab47bd475f81fe5e
MD5 32f85126cc28aaa642e3452579810664
BLAKE2b-256 9fd546b8324db6d1088a734ef02600075b0401f43b1bb7fb4f2c56abd3f33a37

See more details on using hashes here.

File details

Details for the file imperio_api-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: imperio_api-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for imperio_api-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfbcb39424f65d8815a97ec5192d244f1d7a91a4cc0eeef54d5912ceeb164fdc
MD5 7048d2ca7f0978bdc62d69d5d7e792df
BLAKE2b-256 1e7772da5c981e13dfd691ebc0a4291350657e786d98cd9e0fed4d6d84ae280f

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