Docs

Build a Scheduled Task

Scheduled tasks, also known as scheduled jobs or cron jobs, are automated processes executed at specific times or intervals. They’re great for repetitive operations, like data backups, sending reports, or updating website content.

They can be created in py.space by creating a Script widget, writing the code you want to run regularly, and pressing the “Schedule” button.

Example: Quote Web Scraper

Web scraping involves extracting information from websites and is used for data collection, market research etc…

Here’s a widget that uses web scraping to extract the “Quote of the Day” from the Wikiquote page, and sends it to you by email every day:

Here’s how you build it:

1. Create a Script widget

Go to your account’s homepage, and under “What do you want to build?”, click Script.

By default, the script will come with a little “Hello World” content. Delete that code, and copy-paste the code from the web scraper example above.

2. Set up a Scheduled Task

At the bottom-right of the page, click Schedule. In the pop-up box, choose when you run this task:

“Every 1 day at 08:00 UTC” should do the trick:

Schedule Dialog Box

Schedule Dialog Box

3. Run it, just to be sure

You can test your Scheduled Task immediately by clicking Run. If you wait a few moments, you’ll see its output, and if you check the email you used to sign up for py.space, you’ll see you now have a message.

You will now receive the WikiQuote Quote of the Day by email every night!

4. Share it!

Click the toggle at the top of the widget to make it public on your py.space profile!


Do you still have questions?

Our Community Forum is full of helpful information and friendly experts.