ovh-bills-pdf/README.md

61 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

2022-04-09 00:31:00 +02:00
# OVH-Bills-PDF
A simple way to download you're bills automaticaly
[![Build Status](https://drone.dryusdan.fr/api/badges/Dryusdan/ovh-bills-pdf/status.svg?ref=refs/heads/main)](https://drone.dryusdan.fr/Dryusdan/ovh-bills-pdf)
## Install it
This project use poetry
```bash
git clone https://git.dryusdan.fr/Dryusdan/ovh-bills-pdf.git
cd ovh-bills-pdf
pip3 install poetry
poetry install --no-dev
```
If you don't want a virtualenv, run command bellow before poetry install
```bash
poetry config virtualenvs.create false --local
```
Copy secrets.yaml.sample into `~/.config/ovh-bills-pdf/secrets.yaml` and update it. You can add as many accounts as you want.
## Configure it
To configure your application, you need before your app key. More information (different region so different API) : https://github.com/ovh/python-ovh#1-create-an-application
You can allow all endpoint (`*`) but I recommand this two endpoints :
- `/me/bill`
- `/me/bill/*`
After this, you need to get you're ovh client endpoint name (here call region) : https://github.com/ovh/python-ovh#2-configure-your-application
```yaml
name: Paperless #You're app name
accounts:
- name: "OVHcloud XXX" #You're account name, only for log
app_key: #Application key
app_secret: You're application secret
consumer_key: You're consummer key
region: ovh-eu # Region (endpoint name)
- name: "Kimsufi XXX" # A second account. You can create many accounts
app_key:
app_secret:
consumer_key:
region: kimsufi-eu
download_path: /var/opt/paperless/consume #Path to save file (for me in paperless)
timezone: Europe/Paris #You're timezone
```
## Run it
To run this tool the first time, go to program folder and enter this command :
```bash
poetry run python3 src/main.py download-all
```
And periodicaly (the saturday for exemple) :
```
3 16 * * 6 cd path/to/ovh-bills-pdf/ && /var/opt/paperless/.local/bin/poetry run python3 src/main.py
```
Replace `/var/opt/paperless` by your own home repository