Skip to content

seeuletter/seeuletter-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seeuletter-python

PyPI version Dependency Status

Seeuletter.com Python bindings is a simple but flexible wrapper for the Seeuletter.com API.

See full Seeuletter.com documentation here.

For best results, be sure that you're using the latest version of the Seeuletter API and the latest version of the Python wrapper.

French

Un module Python pour envoyer du courrier postal ou électronique en ligne depuis votre application Python.

Seeuletter propose une API permettant d'envoyer très facilement du courrier postal depuis votre ERP, CRM ou application web.

Pas de frais d'installation. Pas d'engagement. Vous payez ce que vous consommez.

Documentation : https://docs.seeuletter.com/?python

Bien démarrer : https://www.seeuletter.com/guide/bien-demarrer-avec-l-api-d-envoi-de-courrier

Table of Contents

Getting Started

Here's a general overview of the Seeuletter services available, click through to read more.

Please read through the official API Documentation to get a complete sense of what to expect from each endpoint.

Registration

First, you will need to first create an account at Seeuletter.com and obtain your Test and Live API Keys.

Once you have created an account, you can access your API Keys from the API Keys Panel.

Installation

seeuletter-python can be installed through the pip or easy_install:

pip install seeuletter
easy_install seeuletter

Usage

Create a new letter

import seeuletter
seeuletter.api_key = 'your-api-key'

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>Hello {{name}},</html>""",
    source_file_type="html",
    variables={
        'name': 'Erlich'
    },
    postage_type="prioritaire",
    color="bw"
)

print "Letter Response : "
print "\n"
print example_letter
print "\n"

Create a new electronic letter

import seeuletter
seeuletter.api_key = 'your-api-key'

example_letter = seeuletter.Letter.createElectronic(
    description='Test Electronic Letter from Python Bindings',
    to_address={
        email: 'erlich.dumas@example.com',
        first_name: 'Erlich',
        last_name: 'Dumas', 
        status: 'individual'
    },
    content: 'Please review the attached documents:',
    source_file="""<html>Hello {{name}},</html>""",
    source_file_type="html",
    variables={
        'name': 'Erlich'
    },
    postage_type="lre"
)

print "Letter Response : "
print "\n"
print example_letter
print "\n"

List all letters

import seeuletter
seeuletter.api_key = 'your-api-key'

list_letters = seeuletter.Letter.list()

print "List Letters : "
print "\n"
print list_letters
print "\n"

Retrieve a specific letter

import seeuletter
seeuletter.api_key = 'your-api-key'

get_letter = seeuletter.Letter.retrieve('ID_OF_THE_LETTER')

print "Get Letter : "
print "\n"
print get_letter
print "\n"

Accounts

Create a new account for the company

import seeuletter
seeuletter.api_key = 'your-api-key'

example_account = seeuletter.Account.create(
  email="msb.partner@example.com",
  name="Erlich Bachman",
  phone="+33104050607",
  company_name="MSB Partner from Python Wrapper",
  address_line1='30 rue de rivoli',
  address_line2='',
  address_city='Paris',
  address_country='France',
  address_postalcode='75004'
)

print "New Account Response : "
print "\n"
print example_account
print "\n"

Update the account company email

import seeuletter
seeuletter.api_key = 'your-api-key'

seeuletter.Account.updateEmail(
    "ACCOUNT COMPANY ID",
    "msb.partner.new@example.com",
)

print "Email Account Updated"
print "\n"

Invoices

List all invoices for a company

import seeuletter
seeuletter.api_key = 'your-api-key'

example_list_invoices = seeuletter.Invoice.list(
  status="paid",
  date_start="2020-01-01"
)

print "List Invoice Response : "
print "\n"
print example_list
print "\n"

Retrieve a specific invoice

import seeuletter
seeuletter.api_key = 'your-api-key'

example_invoice = seeuletter.Invoice.retrieve("INVOICE ID")

print "Invoice Response : "
print "\n"
print example_invoice
print "\n"

Examples

We've provided various examples for you to try out here.

=======================

Copyright © 2017 Seeuletter.com

Released under the MIT License, which can be found in the repository in LICENSE.txt.