Blog
Guides

Build cards faster with our Python client library

Kamil Sindi
Head of Engineering
Nick Hu
Product Manager
May 6, 2022
 • 
#
 min read

Today we are launching a Python client library to help more developers build cards using the Lithic platform. This is our second library – we launched our first library in March in Node.js with Typescript.

These libraries reduce the time it takes to navigate and build with our API. That’s why we’re excited for this launch and are planning to continue expanding to other languages.

If you would like us to consider adding libraries in another programming language, send us a note at sdk-feedback@lithic.com.

Why we're launching a Python library

Like JavaScript, Python consistently ranks as one of the top programming languages used by developers. Due to its wide adoption, we knew adding a Python library would be an effective way to help more developers build card products with Lithic.

The Lithic Python library provides convenient access to the Lithic REST API from any Python 3.7+ application. It includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients.

How to use our Python Library for card issuing

from lithic import Lithic

client = Lithic(
   api_key="my api key", # defaults to os.environ.get("LITHIC_API_KEY")
   environment="sandbox" # defaults to "production"
)

card = client.cards.create({
   "type": "PHYSICAL"
})

print(card.token)

Python

You can use the client to execute a wide range of common operations like:

  1. Listing transactions and other resources with auto-pagination so you don’t have to query successive pages manually
  2. Automatic retries with a short exponential backoff
  3. Creating cards and accounts
  4. Adding funding sources
  5. Request timeouts
  6. Error handling
  7. Configuring custom URLs, proxies, and transports

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

Request parameters are TypedDicts, while responses are Pydantic models. This helps provide autocomplete and documentation within your editor.

If you would like to see type errors in VS Code to help catch bugs earlier, set python.analysis.typeCheckingMode to "basic".

Start building

To start using our client, install it via PIP.

pip install lithic

We’re releasing this Python library in beta. If you encounter any bugs or issues, please flag them by sending an email to sdk-feedback@lithic.com.

Visit our docs or sign up to start issuing cards. No “contact sales” or MSA required.

Want a payments platform that helps you as you grow?