Skip to main content

Label parcels without pain

Project description


Roulier is a shipping library written in Python for sending parcels.
Roulier will get a label + tracking number to your carrier for you.

![big picture](overview.svg)

* Roulier runs on your server and call each carrier API directly.
* You have to use your own credentials provided by each carriers.
* Roulier is Open Source software, AGPL-3
* Roulier integrate a multitude of carriers : Laposte, Geodis, DPD, K&N, TRS... more to come.

### Usage

from roulier import roulier

laposte = roulier.get('laposte')

response = laposte.get_label({
"auth": {
"login": "12345",
"password": "password",
"service": {
"productCode": "COL"
"parcel": {
"weight": 3.4,
"to_address": {
"firstName": "Hparfr"
"street1": "35 b Rue Montgolfier"
"city": "Villeurbanne"
"country": "FR",
"zip": "69100"
"from_address": {
"fristName": "Akretion France"
"street1": "35 b Rue Montgolfier"
"city": "Villeurbanne"
"country": "FR",
"zip": "69100"

print response


Get supported carriers:
from roulier import roulier
print roulier.get_carriers()

To get the full list of parameters:
from pprint import pprint
from roulier import roulier

laposte = roulier.get('laposte')

# ...


### Advanced usage for Laposte

Usefull for debugging: get the xml before the call, send an xml directly, analyse the response

from roulier import roulier
laposte = roulier.get('laposte')

#0) create dict for the request as usually
api = laposte.api();
api['auth']['login'] = '12345'

# 1) get the sls xml:
req = laposte.encoder.encode(api, 'generateLabelRequest')
# req['body'] contains the xml payload (<sls:generateLabel xmlns:sls="">...</sls:generateLabel>)

# 2) get the soap message
soap_request =['body'], req['headers'])
#soap_request is a string (xml)

# 3) send xml_request to ws
soap_response =
# soap_response is a Requests response

# 4) interpret the response
data =

# 5)get the raw Request Response:

It's more or less the same for every carrier with SOAP webservice.

Validate input

For input validate we use [Cerberus](
from roulier import roulier
laposte = roulier.get('laposte')

# get a ready to fill dict with default values:

# advanced usage :
from roulier.carriers.laposte.laposte_api import LaposteApi
l_api = LaposteApi()

# get the full schema:

# validate a dict against the schema
a_dict = { 'auth': {'login': '', 'password': 'password'}, ... }
# > {'auth': [{'login': ['empty values not allowed']}], ...}

# get a part of schema (like 'parcel')


* [@hparfr]( ([](
* [@damdam-s]( ([](
* [@bealdav]( ([](

### Dependencies

* [Cerberus]( - input validation and normalization
* [lxml]( - XML parsing
* [Jinja2]( - templating
* [Requests]( - HTTP requests
* [zplgrf]( - PNG to ZPL conversion
* [unidecode]( - Remove accents from ZPL
* [unicodecsv]( - CSV generation

Project details

Download files

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

Files for roulier, version 0.1.1rc6
Filename, size File type Python version Upload date Hashes
Filename, size roulier-0.1.1rc6.tar.gz (21.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page