ouigo-searcher is a python script that checks if a specific trip ticket is available in Ouigo page and notifies you with an email.
Look for specific ouigo ticket using:
- Date to filter
- Trip departure city
- Trip destination city
It will send an email too when the ticket is available, using:
- Gmail username
- Gmail password
Now that Google has disabled the "less security" options, you'll need to set up your account to use 2-Step Verification and create an app password before you can use it in this script.
To do this, you can go to the Google Help Center or you can check this blog catwoot blog.
ouigo-searcher requires Python to run.
Install the requests module and execute the scrip:
Run the following command:
pip install -r requirements.txt
This script uses the arguments to look for a specific ticket in the Ouigo page.
These arguments must be in their right position, so that the script can use them correctly.
python ./ouigo.py <date_to_filter> <gmail_username> <gmail_password> <email_recipients> <origin_city> <destination_city> <refresh_time>
python ./ouigo.py 2022-12-31 example@gmail.com password123 example1@email.com,example2@email.com,example3@email.com B M 1800
You can also use the help argument which will explain you how to use this script.
This argument must be in the first position, it can be h
, help
or ?
python ./ouigo.py h
These are the mandatory arguments
- date_to_filter: Date to look for the ticket. You must use the format yyyy-mm-dd.
- gmail_username: Gmail user to send the email when a ticket available is found.
- gmail_password: Gmail password to login and send the email correctly.
- email_recipients: Comma listed emails to send the notification.
- origin_city: Trip departure city. You must use one of the following city codes.
- B: BARCELONA
- M: MADRID
- T: TARRAGONA
- V: VALENCIA
- Z: ZARAGOZA
- destination_city: Trip destination city. You must use one of the following city codes.
- B: BARCELONA
- M: MADRID
- T: TARRAGONA
- V: VALENCIA
- Z: ZARAGOZA
These are the optional arguments:
- refresh_time: Time (in seconds) to retry is there's no ticket available. It's 1800 by default
ouigo-searcher can also be executed using docker.
First of all, you need to create a docker image by running the following command:
docker build -t ouigo-searcher .
When the image has been successfully created, you will be able to run the script in docker by running the following command:
docker run ouigo-searcher {{ ARGUMENTS }}
For example:
docker run ouigo-searcher 2022-12-31 example@gmail.com password123 example1@email.com,example2@email.com,example3@email.com B M 1800
There is also a Docker Hub repository with this docker image: csanchezarisa/ouigo-searcher.
You can pull it and use it by running the following command:
docker pull csanchezarisa/ouigo-searcher
docker run csanchezarisa/ouigo-searcher {{ ARGUMENTS }}