Skip to content

ouigo-searcher is a python script that checks if a specific trip ticket is available in Ouigo page and notifies you with an email.

License

Notifications You must be signed in to change notification settings

csanchezarisa/ouigo-searcher

Repository files navigation

Ouigo searcher

A Ouigo ticket searcher

ouigo-searcher is a python script that checks if a specific trip ticket is available in Ouigo page and notifies you with an email.

Table of contents

  1. Features
  2. Installation
    1. Installing requests module
  3. How to use the script
    1. Example
    2. Help argument
    3. Mandatory arguments
    4. Optional arguments
  4. Docker
    1. Building the image
    2. Running the script
    3. Docker Hub repo

1. Features

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.

2. Installation

ouigo-searcher requires Python to run.

Install the requests module and execute the scrip:

2.1. Installing requests module

Run the following command:

pip install -r requirements.txt

3. How to use the script

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.

3.1. Example

python ./ouigo.py <date_to_filter> <gmail_username> <gmail_password> <email_recipients> <origin_city> <destination_city> <refresh_time>
python ./ouigo.py 2022-12-31 [email protected] password123 [email protected],[email protected],[email protected] B M 1800

3.2. Help argument

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

3.3. Mandatory arguments

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

3.4. Optional arguments

These are the optional arguments:

  • refresh_time: Time (in seconds) to retry is there's no ticket available. It's 1800 by default

4. Docker

ouigo-searcher can also be executed using docker.

4.1. Building the image

First of all, you need to create a docker image by running the following command:

docker build -t ouigo-searcher .

4.2. Running the script

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 [email protected] password123 [email protected],[email protected],[email protected] B M 1800

4.3. Docker Hub repo

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 }}

About

ouigo-searcher is a python script that checks if a specific trip ticket is available in Ouigo page and notifies you with an email.

Topics

Resources

License

Stars

Watchers

Forks