Automation Blog

Python Libraries Supported in Zapier Code Steps: What's Available and How to Use Them

A reference guide to the Python standard library modules and third-party packages available inside Zapier's Python Code steps — what you can import, what constraints apply, and how to work within the environment.

ZapierPythonCode Steps

By Troy Tessalone · · 4 minutes

Automation Guide

A practical field guide from Automation Ace.

Python Libraries Supported in Zapier Code Steps: What's Available and How to Use Them

Zapier's Code by Zapier action includes a Python option — a sandboxed Python runtime that runs inside a Zap step, receives data from previous steps as input variables, and returns a dictionary of output values usable in subsequent steps. The Python environment is pre-configured with a curated set of standard library modules and third-party packages. Knowing what is available before you write a Code step saves time and prevents the frustration of discovering a missing package mid-build. This article covers the Python libraries available in Zapier Code steps and the practical implications of the environment constraints.

The Zapier Python Runtime Environment

Zapier's Python Code steps run in a server-side sandbox — not on your machine. You cannot install packages with pip, cannot write to a local filesystem, cannot import arbitrary third-party libraries, and cannot make changes to the runtime environment. You work with what is provided. The Python version available in Zapier Code steps is Python 3 (Zapier has documented the specific version in their help documentation, which may update over time — check Zapier's current Code step documentation for the exact version).

Input data from previous Zap steps is available in the input_data dictionary. The Code step must return a Python dictionary — the keys and values of that dictionary become the output fields available to subsequent Zap steps.

Python Standard Library: What's Available

The Python standard library is broadly available in Zapier Code steps. Commonly used standard library modules that work reliably include:

  • json — parsing and serializing JSON data (the most commonly needed module in Zap Code steps)
  • datetime — date and time manipulation, formatting, timezone handling
  • re — regular expressions for pattern matching and string extraction
  • math — mathematical functions
  • hashlib — cryptographic hashing (MD5, SHA-256, etc.) — useful for generating signatures or checksums
  • base64 — encoding and decoding base64 data — commonly needed for API authentication headers
  • urllib.parse — URL encoding and parsing
  • collections — OrderedDict, defaultdict, Counter, and other data structures
  • itertools — tools for working with iterables
  • string — string constants and template formatting
  • decimal — precise decimal arithmetic (important for financial calculations)
  • calendar — calendar-related utilities
  • time — time-related functions (note: sleep() in a Zap step will simply delay execution, subject to Zapier's step timeout)
  • hmac — keyed-hashing for message authentication — useful for webhook signature verification
  • uuid — generating unique identifiers

Third-Party Packages Available

Zapier's Python environment includes a pre-installed set of third-party packages. The most significant and commonly used include:

  • requests — HTTP requests library; this is the primary way to make API calls from a Python Code step when Webhooks by Zapier or API by Zapier does not provide enough control
  • pytz — timezone definitions and conversions, complements the datetime module for timezone-aware datetime handling
  • dateutil — enhanced date parsing (the dateutil.parser.parse() function handles a wide variety of date string formats)
  • bs4 (BeautifulSoup4) — HTML parsing, useful for extracting data from HTML content received via webhook or API response
  • lxml — XML and HTML processing
  • pycryptodome or cryptography — cryptographic operations beyond what hashlib and hmac provide

Zapier maintains a help article listing the currently supported Python packages — always check the current list in Zapier's documentation, as the available packages change as Zapier updates the runtime environment. The Zapier community thread referenced at community.zapier.com is a useful community-maintained reference for what is currently available.

What Is Not Available

The Python Code step environment intentionally excludes packages that would conflict with the sandboxed nature of the runtime:

  • No file system access — you cannot read or write files; data must flow in via input_data and out via the return dictionary
  • No subprocess execution — you cannot spawn other processes
  • No GUI or display libraries (tkinter, matplotlib for display, etc.)
  • No database drivers (psycopg2, pymysql, etc.) — database access must be via an API layer
  • No pip install at runtime — the environment is fixed
  • No network sockets beyond what requests provides

If you need a library that is not available in the Code step environment, the options are: find a standard library equivalent, restructure the Zap to avoid needing it (often possible by using a different trigger or action to fetch/transform the data before it reaches the Code step), or consider moving the logic to an external service (an AWS Lambda function, a small Python script on a VPS, or a Make scenario with more flexible module support) that the Zap calls via webhook.

The requests library combined with the standard library covers the vast majority of what Python Code steps are used for in Zapier: fetching data from APIs, parsing JSON, manipulating dates and strings, computing hashes for authentication signatures, and building structured output for downstream Zap steps. If you are reaching beyond that, evaluate whether a Code step is the right tool.

Practical Patterns for Python Code Steps

The most common uses of Python in Zapier Code steps:

  • Parsing a complex JSON payload from a webhook that Zapier's native field mapping cannot navigate cleanly
  • Computing an HMAC signature for an API authentication header using hmac and hashlib
  • Date arithmetic — adding or subtracting days, converting timezones with pytz, formatting dates for specific API requirements
  • Making a multi-step API call (authenticate, then fetch, then process) that cannot be split across separate Webhooks steps without losing context
  • String transformation that exceeds what Formatter by Zapier can handle

For the JavaScript equivalent of this guide, see JavaScript and Node.js libraries supported in Zapier Code steps. For a broader look at when to use Python and JavaScript in automation workflows, see the dedicated guide. For help writing a Python Code step for a specific use case, talk to Automation Ace.

ZapierPythonCode Steps

Disclaimer: This article may include links to apps, products, or services. Some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the workflow, integration, AI assist, or code bridge that fits your business.

Start a Project →