Skip to content

Added 2 more python examples #1800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,22 @@
}
]
},
{
"group": "Python guides",
"pages": [
"guides/python/python-image-processing",
"guides/python/python-crawl4ai",
"guides/python/python-pdf-form-extractor"
]
},
{
"group": "Example projects",
"pages": [
"guides/example-projects/batch-llm-evaluator",
"guides/example-projects/claude-thinking-chatbot",
"guides/example-projects/realtime-fal-ai",
"guides/example-projects/realtime-csv-importer",
"guides/example-projects/vercel-ai-sdk-image-generator",
"guides/python/python-crawl4ai"
"guides/example-projects/vercel-ai-sdk-image-generator"
]
},
{
Expand Down
19 changes: 11 additions & 8 deletions docs/guides/python/python-crawl4ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ description: "Learn how to use Python, Crawl4AI and Playwright to create a headl
import ScrapingWarning from "/snippets/web-scraping-warning.mdx";
import PythonLearnMore from "/snippets/python-learn-more.mdx";

## Overview

This demo showcases how to use Trigger.dev with Python to build a web crawler that uses a headless browser to navigate websites and extract content.

## Prerequisites

- A project with [Trigger.dev initialized](/quick-start)
- [Python](https://www.python.org/) installed on your local machine

## Overview

This demo showcases how to use Trigger.dev with Python to build a web crawler that uses a headless browser to navigate websites and extract content.

## Features

- [Trigger.dev](https://trigger.dev) for background task orchestration
Expand Down Expand Up @@ -113,7 +113,10 @@ export function installPlaywrightChromium(): BuildExtension {
}
```

Learn more about the [trigger.config.ts](/config/config-file) file including setting default retry settings, customizing the build environment, and more.
<Info>
Learn more about executing scripts in your Trigger.dev project using our Python build extension
[here](/config/extensions/pythonExtension).
</Info>

### Task code

Expand Down Expand Up @@ -212,14 +215,14 @@ if __name__ == "__main__":
1. Create a virtual environment `python -m venv venv`
2. Activate the virtual environment, depending on your OS: On Mac/Linux: `source venv/bin/activate`, on Windows: `venv\Scripts\activate`
3. Install the Python dependencies `pip install -r requirements.txt`
4. If you haven't already, copy your project ref from your [Trigger.dev dashboard](https://cloud.trigger.dev) and and add it to the `trigger.config.ts` file.
5. Run the Trigger.dev dev CLI command with with `npx trigger dev@latest dev` (it may ask you to authorize the CLI if you haven't already).
4. If you haven't already, copy your project ref from your [Trigger.dev dashboard](https://cloud.trigger.dev) and add it to the `trigger.config.ts` file.
5. Run the Trigger.dev CLI `dev` command (it may ask you to authorize the CLI if you haven't already).
6. Test the task in the dashboard, using a URL of your choice.

<ScrapingWarning />

## Deploying your task

Deploy the task to production using the CLI command `npx trigger.dev@latest deploy`
Deploy the task to production using the Trigger.dev CLI `deploy` command.

<PythonLearnMore />
Loading