VOOZH about

URL: https://apify.com/apify/example-code-runner-python

⇱ Example Code Runner (Python) Β· Apify


Pricing

Pay per usage

Go to Apify Store

Example Code Runner (Python)

Python Actor to run code examples from the documentation via "Run on Apify" links.

Pricing

Pay per usage

Rating

4.5

(3)

Developer

πŸ‘ Apify

Apify

Maintained by Apify

Actor stats

1

Bookmarked

1.4K

Total users

34

Monthly active users

11 days ago

Last modified

Share

The Actor behind the "Run on Apify" buttons in Python documentation, such as crawlee.dev/python and docs.apify.com. It takes a Python snippet as input and runs it, so a single Actor can execute code samples from both the Apify SDK and Crawlee.

Input

FieldTypeDescription
codestringPython code to execute. Must define a main function (sync or async).
{
"code":"async def main() -> None:\n print('Hello world!')\n"
}

If the snippet uses Actor, the runner hands over its own Actor context so the code can manage its lifecycle (SDK examples create their own context; Crawlee examples don't).

Run locally

This is a uv-managed project. You'll also need the Apify CLI.

uv sync
apify run -i'{"code": "async def main() -> None:\n print(\"hi\")\n"}'

Deploy to Apify

apify login # once, with your API token
apify push # build and deploy the Actor

You might also like

Example Code Runner (Playwright)

apify/example-code-runner-playwright

Generic Actor to run code examples from the documentation via "Run on Apify" links.

Example Code Runner (Cheerio)

apify/example-code-runner-cheerio

Generic Actor to run code examples from the documentation via "Run on Apify" links.

Example Code Runner (Puppeteer)

apify/example-code-runner-puppeteer

Generic Actor to run code examples from the documentation via "Run on Apify" links.

Python Example

apify/python-example

Example Actor written in Python, showing how to read the Actor input and push to the Actor's default dataset.

My Actor 1

monisha08/my-actor-1

Python

πŸ‘ User avatar

Monisha Monisha.R

2

Python Empty Template

ellustar/my-actor-32

**Python Empty Template is a minimal starter actor for building Python-based automations and scrapers on Apify. It provides a clean structure, basic input/output handling, and integration with the Apify Python SDK, letting you quickly create custom workflows.**

Python Scraper Template

ellustar/my-actor-80

A ready-to-use Python Scrapy template actor for Apify Store. It helps developers quickly build, deploy, and scale web scraping projects with structured settings, proxy support, data extraction examples, and seamless Apify platform integration.

Related articles

Apify ❀️ Python, so we’re releasing a Python API client
Read more
Python web scraping tutorial (Step-by-step guide)
Read more
How to scrape Amazon product data using Python (+ no-code)
Read more