https://github.com/furqonat/flask-scheduler
Flask Scheduler extension
https://github.com/furqonat/flask-scheduler
background-scheduler extensions flask python3
Last synced: about 2 months ago
JSON representation
Flask Scheduler extension
- Host: GitHub
- URL: https://github.com/furqonat/flask-scheduler
- Owner: furqonat
- License: mit
- Created: 2022-10-24T20:53:23.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-21T03:17:39.000Z (over 3 years ago)
- Last Synced: 2025-02-13T12:16:53.314Z (over 1 year ago)
- Topics: background-scheduler, extensions, flask, python3
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flask Scheduler
Flask Scheduler is a simple Flask extension that allows you to schedule tasks to run at specific times.
It uses the APScheduler library to schedule tasks.
## Installation
Install Flask Scheduler using pip:
```shell
pip install Flask-Scheduler
```
## Usage
To use Flask Scheduler, import the extension and initialize it with your Flask app:
```python
from flask import Flask
from flask_scheduler import Scheduler
app = Flask(__name__)
# Initialize the extension
scheduler = Scheduler(app)
# scheduler config interval
app.config['SCHEDULER_API_INTERVAL'] = 5 # in seconds
@scheduler.runner()
def my_task():
print('hi im running every 5 seconds')
# if you have separate task, and you don't want to run it every 5 seconds
# you can use interval argument in decorator
@scheduler.runner(interval=10)
def my_task1():
print('hi im running every 10 seconds')
```
## Contributing
Contributions are welcome! Please submit a pull request.