n8n-code-python

Write Python in n8n Code nodes using only the standard library.

Updated Jan 20, 2026
One-click install
npx skills add https://github.com/Gingi892/automation-shamai --skill n8n-code-python-gingi892
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: n8n-code-python
Source: https://github.com/Gingi892/automation-shamai/tree/main/skills/n8n-code-python
Command: npx skills add https://github.com/Gingi892/automation-shamai --skill n8n-code-python-gingi892

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solves the challenge of writing Python inside n8n Code nodes while adhering to the no external libraries rule.

Core Features & Use Cases

  • Batch and per-item data transformations using the standard library (json, datetime, re, base64, hashlib, urllib.parse, math, random, statistics)
  • Safe data handling with underscore data access patterns (_input.all(), _input.first(), or _input.item) and webhook payloads via the body key
  • Clear guidance on Python limitations, recommended practices, and consistent return formats for n8n workflows

Quick Start

Create a simple Python Code node that reads all items with _input.all(), processes each item, and returns a list of {"json": ...} objects. No external libraries are required; build with standard library functions and ensure the result matches the required output format.

Frequently Asked Questions about n8n-code-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Python in n8n Code nodes without external libraries?

Python in n8n Code nodes supports the standard library only, including json, datetime, re, base64, hashlib, and math. You cannot install or import external libraries, so all data transformations and webhook payload handling must rely on these built-in modules.

How do I access webhook payload data using Python in an n8n workflow?

Access webhook payloads in n8n Python Code nodes by referencing the body key within your input data. Apply safe dictionary access patterns to extract fields, then process the payload using standard library tools like json and hashlib for consistent return formats.

Can I use external Python packages for data transformation in n8n?

No, n8n Code nodes enforce a strict no external libraries rule for Python. You must perform batch and per-item data transformations using only the standard library, such as json, re, base64, and datetime, without importing third-party packages.

What is the correct return format for n8n Python Code nodes?

The correct return format for n8n Python Code nodes is a list of {"json": ...} objects. After processing input items with standard library functions, structure your output consistently as a list of these dictionaries to ensure downstream workflow nodes receive the transformed data.

How do I handle per-item data transformations in n8n Python Code nodes?

Handle per-item data transformations in n8n Python Code nodes by iterating through _input.all() or accessing a single item with _input.first(). Apply standard library functions like re and datetime to each item, then return the transformed results as a list of {"json": ...} objects.

What are the limitations of using Python in n8n Code nodes?

The primary limitation of Python in n8n Code nodes is the strict no external libraries rule. You are restricted to standard library modules like json, datetime, and math, and you must follow specific underscore data access patterns and consistent return formats to ensure safe execution.