Benjamin Sigonneau 48391ee808 Retrieve max_quantity and check if quantity belongs to interval
This is because min_level was adjusted recently. Now we check if 500L
and 1000L belongs to the given intervals, and we do not assum they are
lower bounds of such intervals.
2022-11-19 22:13:54 +01:00
2022-08-06 22:38:08 +02:00
2022-08-21 23:47:59 +02:00
2022-07-21 00:40:45 +02:00
2022-07-20 23:53:51 +02:00
2022-08-16 00:43:16 +02:00
2022-07-21 00:40:45 +02:00
2022-07-21 00:32:05 +02:00

Get current fioul price from Bretagne Multi Énergie and store it. Also with an incredible web interface to list price history.

Requirements

This project is written in Python and uses the following libraries:

  • requests: to retrieve current price using a GraphQL query;
  • peewee: a simple ORM, to store and query the data in a SQL database;
  • bottle: a micro web framework.

Those libraries are all packaged in Debian and can be installed with:

apt install python3-request python3-peewee python3-bottle

Optional: a MySQL server (although switching to another database should be easy). Otherwise, a SQLite backend can be used.

Installation

We suppose the repository is cloned under /opt/fioul.

Create a fioul.ini config file, and fill in MySQL credentials. You can use fioul.ini.example as a starting point. MySQL database can be created with the following commands:

create database fiouldb;
create user 'fioul'@'localhost' identified by 'fioul_is_beautifioul';
grant all privileges on fiouldb.* TO 'fioul'@'localhost';

Tables can be created by running ./fioul.py initdb

To update the database day at 9:30am, the following line can be installed as a cronjob:

30 09 * * * /opt/fioul/fioul.py update

To launch the server automatically, you can install and use the systemd service file :

adduser --system --group --no-create-home fioul
ln -s /opt/fioul/fioul.service /etc/systemd/system/fioul.service
systemctl enable fioul.service
systemctl start fioul.service

The server listens to port 9980 on localhost by default, unless otherwise specified in the config file. Setting up a reverse proxy and ssl is left as an exercise to the reader.

Description
No description provided
Readme 1.7 MiB
Languages
CSS 52.9%
Python 35.9%
Smarty 11.2%