Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Lob Python Bindings

Project description


Build Status PyPI version Coverage Status

This is the python wrapper for the API. See full documentation here. For best results, be sure that you're using the latest version of the Lob API and the latest version of the python wrapper.

This library supports active Python releases (i.e., versions which have not reached their end of life), as well as PyPy and PyPy 3. The currently supported versions include:

  • Python 2.7
  • Python 3.5
  • Python 3.6
  • Python 3.7
  • PyPy
  • PyPy 3

Table of Contents

Getting Started

Lob Python wrapper works in the object oriented style. That is, to make calls you have to call the method on a class and the return types are python objects. To get a dict on any object, you can call the to_dict() method of the object.

Here's a general overview of the Lob 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.


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

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


You can use pip to install the package.

pip install lob

To initialize the wrapper, import lob and set the api_key

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

// set an api version (optional)
lob.api_version = 'api-version'


We've provided an example script you can run in examples/ that has examples of how to use the lob-python wrapper with some of our core endpoints.


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

There are simple scripts to demonstrate how to create all the core Lob objects (checks, letters, postcards. etc.) as well as more complex examples that utilize other libraries and external files.

API Documentation


lob-python uses Pipenv to manage development environments and dependencies.

You install all the development requirements by running

$ pipenv install --dev
$ pipenv shell

You can run all tests with the command LOB_API_KEY=YOUR_TEST_API_KEY nosetests in the main directory.


Making Releases

lob-python includes bumpversion as a development dependency. This tool should be used when changing the version number, as it will ensure that it's updated correctly and consistently.

Running bumpversion will increment the specified version part (major, minor, patch), commit the change, and tag it.

$ bumpversion <part>

After the version has been bumped, you can push the change and tag.

$ git push origin head
$ git push origin --tags

Finally, create the distribution and push it to PyPI using twine.

$ python sdist
Writing lob-4.0.0/setup.cfg
Creating tar archive
removing 'lob-4.0.0' (and everything under it)
$ twine upload dist/lob-4.0.0.tar.gz

Copyright © 2013-2019

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

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 lob, version 4.0.1
Filename, size File type Python version Upload date Hashes
Filename, size lob-4.0.1-py3-none-any.whl (8.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size lob-4.0.1.tar.gz (7.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