Supported Python libraries

Code tools come with the libraries below already installed. Python's standard library — for example json, csv, datetime, re, math and zipfile — is also available. Libraries not listed here aren't supported.

Calling APIs and web services

Connect to other systems — for example, look up a ticket or update an employee record.

  • requests — Sends HTTP requests and reads the responses. The usual choice for calling a REST API.
  • httpx — A modern HTTP client, similar to requests.
  • urllib3 — Manages the HTTP connections underneath requests.
  • certifi — Provides trusted certificates so HTTPS connections are verified.

Working with data

Filter, combine and summarise records — for example, joining data from two systems or totaling expenses by team.

  • pandas — Works with tables of data: filter, sort, group, join and summarize. Also reads and writes CSV and Excel files.
  • numpy — Fast math on lists of numbers.
  • tabulate — Formats data as a readable text table.

Dates and time zones

Handle dates in any format and across time zones — for example, working out a leave end date or converting a meeting time.

  • python-dateutil — Reads dates written in almost any format and does date math, like adding three months.
  • pytz — Converts times between time zones.

Reading and editing PDFs

Pull information out of PDF files — for example, reading the amounts on an invoice.

  • pdfplumber — Extracts text and tables from PDFs.
  • pypdf — Reads PDF text and pages, and splits, merges or rotates PDFs.

Creating PDFs

Generate PDF documents — for example, a letter, certificate or report.

  • reportlab — Builds detailed PDFs with text, tables, images and charts.
  • fpdf2 — Creates simpler PDFs quickly, like letters or receipts.

Word, PowerPoint and Excel files

Read or create Office documents — for example, filling in an offer letter or building a weekly Excel report.

  • python-docx — Reads and creates Word (.docx) documents, including text, tables and formatting.
  • python-pptx — Reads and creates PowerPoint (.pptx) presentations.
  • openpyxl — Reads, creates and edits Excel (.xlsx) files, including formulas and formatting.
  • XlsxWriter — Creates new Excel (.xlsx) files with formatting, formulas and charts.

Older .doc, .ppt and .xls files aren't supported.

Images

Work with image files — for example, resizing a photo or converting it to another format.

  • Pillow — Opens, resizes, crops, rotates and converts images such as PNG and JPEG.

Web pages and XML

Pull data out of HTML or XML — for example, reading a SOAP API response or an XML feed.

  • beautifulsoup4 — Finds and extracts content from HTML pages.
  • lxml — Fast HTML and XML parsing, including XPath queries.

Other text formats

Read and check structured text — for example, a YAML file or a JSON payload.

  • PyYAML — Reads and writes YAML.
  • jsonschema — Checks that JSON data has the expected fields and types.
  • markdown — Converts Markdown text to HTML, for example for an email body.
  • chardet — Detects a file's text encoding, so files from older systems read correctly.

Templates

Fill in a template with data — for example, an email, an HTML page or a letter.

  • Jinja2 — Fills templates with data, with support for loops and conditions.

Security and tokens

Protect data and sign in to APIs — for example, signing a request or creating a token for a service account.

  • cryptography — Encrypts and decrypts data, creates hashes and signatures, and works with keys and certificates.
  • PyJWT — Creates and checks JSON Web Tokens (JWTs), often used to sign in to APIs.

Did this page help you?