Skip to main content

lob-python

Build Status PyPI version Coverage Status

This is the python wrapper for the Lob.com API. See full Lob.com 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 3. The currently supported versions include:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9
  • 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.

Registration

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

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

Installation

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'

Usage

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.

Examples

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

The full and comprehensive documentation of Lob's APIs is available here.

Testing

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 pytest in the main directory.

$ LOB_API_KEY=YOUR_TEST_API_KEY pytest

Alternatively you can add the LOB_API_KEY to a .env file in the project root directory and use the pipenv run tests script.

pipenv run tests

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 setup.py 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 Lob.com

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

Metadata

Release files for lob 4.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lob 4.5.4
File Size Uploaded
lob-4.5.4.tar.gz 9.2 kB Details

Release files / lob-4.5.4.tar.gz

Download URL lob-4.5.4.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d2f343a926541ce659d88ba31227e0649acd3b23b76bd96cd23fc5c41531903e
BLAKE2b-256 checksum
How to use checksums
6760d73847fbb05fa4fa1e3092a33608e86f010ba090c9d4b74c9b268db05a2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

4.5.4 This release

1 release file

4.5.3

1 release file

4.5.2

1 release file

4.5.1

1 release file

4.5.0

1 release file

4.4.0

1 release file

4.3.0

1 release file

4.2.0

1 release file

4.1.0

1 release file

4.0.2

1 release file

4.0.1

2 release files

4.0.0

1 release file

3.4.0

1 release file

3.3.0

1 release file

3.2.0

1 release file

3.1.3

1 release file

3.1.2

1 release file

3.1.1

1 release file

3.0.1

1 release file

3.0

1 release file

2.26

1 release file

2.25

1 release file

2.24

1 release file

2.23

1 release file

2.22

1 release file

2.21

1 release file

2.20

1 release file

2.19

1 release file

2.18

1 release file

2.17

1 release file

2.16

1 release file

2.15

1 release file

2.14

1 release file

2.13

1 release file

2.12

1 release file

2.11

1 release file

2.10

1 release file

2.9

1 release file

2.8

1 release file

2.7

1 release file

2.6

1 release file

2.5

1 release file

2.4

1 release file

2.3.3

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page