Seeuletter Python Bindings

1.2.0 · maintenance · verified Sat Apr 11

Seeuletter Python Bindings is a simple but flexible wrapper for the Seeuletter.com API, allowing users to send physical or electronic mail. The current version is 1.2.0. The library provides direct access to the Seeuletter API endpoints for letters, accounts, and invoices, aiming to simplify the process of integrating mail services into Python applications.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Seeuletter client with an API key (preferably from an environment variable) and create a new letter using HTML content. Replace 'your_test_api_key_here' and address details with your actual data. Remember to create an account on Seeuletter.com to obtain your API keys.

import seeuletter
import os

# Set your API key from an environment variable for security
seeuletter.api_key = os.environ.get('SEEULETTER_API_KEY', 'your_test_api_key_here')

try:
    example_letter = seeuletter.Letter.create(
        description='Test Letter from Python Bindings',
        to_address={
            'name': 'Erlich',
            'address_line1': '30 rue de rivoli',
            'address_city': 'Paris',
            'address_postalcode': '75004',
            'address_country': 'France'
        },
        source_file='<html><body><h1>Hello from Seeuletter!</h1></body></html>',
        source_file_type='html'
    )
    print(f"Letter created successfully: {example_letter.id}")
    print(f"Letter status: {example_letter.status}")
except seeuletter.error.APIError as e:
    print(f"Error creating letter: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →