The `lob` Python client library provides bindings for the Lob.com API, enabling programmatic access to services like mail, print, and address verification. This registry entry specifically covers the 4.x series of the library. While still maintained for critical fixes, new major versions (5.x and above) are released under a separate PyPI package, `lob-python`.
pip install lobVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Lob client and create an address object using the `lob` (v4.x) package. Ensure your Lob API key is set as an environment variable named `LOB_API_KEY`. You can obtain test API keys from your Lob dashboard.
To upgrade, install `pip install lob-python` and update imports from `import lob` to `import lob_python`. The API structure also changes, requiring adaptation to the new module and class organization (e.g., `lob_python.Configuration`, `lob_python.api.addresses_api`).
Set `lob.api_key = os.environ.get('LOB_API_KEY', '')` with your secret API key. Never expose secret keys in client-side code.Implement retry logic with exponential backoff or ensure your application adheres to the defined rate limits to avoid service disruption.
Ensure you have obtained a valid Lob API key (test or live) from your dashboard settings and set it correctly as `lob.api_key = 'YOUR_API_KEY'` before making any API calls. Lob uses HTTP Basic authentication where the API key serves as the username, and the password remains blank.
If you are using `lob` v4.x, import the main `lob` module directly (`import lob`) and interact with its top-level classes (e.g., `lob.Addresses`, `lob.Postcards`). If you intend to use v5.x+ features and their associated imports, ensure you install `lob-python` (`pip install lob-python`) instead.
Instantiate the appropriate API service object and call its methods. For address verification in `lob` v4.x, you would typically use `lob.Addresses.verify()` after setting `lob.api_key`.
Review the official Lob API documentation for the specific endpoint you are calling to identify all required parameters. Ensure they are included and correctly populated in your request payload (e.g., all necessary address components like `address_line1`, `address_city`, `address_state`, `address_zip` for an address creation or verification).
No dependency data recorded yet.