PyRistoCloud è un semplicissimo wrapper API, scritto in Python 3.9.9, per verificare se i posti a mensa sono liberi ed effettuare le prenotazioni. Niente di fancy.
pip3 install git+https://github.com/riklus/PyRistoCloud.gitfrom datetime import date
from pyristocloud import pyRc
rc = pyRc.Api()
logged = rc.login("nome.cognome@studenti.unitn.it", "pass")
if logged:
print("Login effettuato!")
else:
print("Errore login.")
exit()
mensa = "mensa_tgar"
data = date.today().strftime("%d/%m/%y")
orario_inizio = "13:15"
orari_prenotati = rc.get_orari_prenotati(mensa, data)
# Controllo se l'orario che voglio prenotare è disponibile
for orario in orari_prenotati:
if orario["isBookale"] and orario["orario_inizio"] == orario_inizio:
if rc.salva_prenotazione(mensa, data, orario["id"]):
print("Prenotazione effettuata:", mensa, data, orario_inizio)
else:
print("Errore nella prenotazione:", mensa, data, orario_inizio)
# Esco se l'orario non è disponibilie
exit()
print("Orario", orario_inizio, "non trovato per il", data, "in", mensa)Per altri esempi visita cartella esempi
Makefile contains a lot of functions for faster development.
1. Download and remove Poetry
To download and install Poetry run:
make poetry-downloadTo uninstall
make poetry-remove2. Install all dependencies and pre-commit hooks
Install requirements:
make installPre-commit hooks coulb be installed after git init via
make pre-commit-install3. Codestyle
Automatic formatting uses pyupgrade, isort and black.
make codestyle
# or use synonym
make formattingCodestyle checks only, without rewriting files:
make check-codestyleNote:
check-codestyleusesisort,blackanddarglintlibrary
Update all dev libraries to the latest version using one comand
make update-dev-deps4. Code security
make check-safetyThis command launches Poetry integrity checks as well as identifies security issues with Safety and Bandit.
make check-safety5. Type checks
Run mypy static type checker
make mypy6. Tests with coverage badges
Run pytest
make test7. All linters
Of course there is a command to rule run all linters in one:
make lintthe same as:
make test && make check-codestyle && make mypy && make check-safety8. Docker
make docker-buildwhich is equivalent to:
make docker-build VERSION=latestRemove docker image with
make docker-removeMore information about docker.
9. Cleanup
Delete pycache files
make pycache-removeRemove package build
make build-removeDelete .DS_STORE files
make dsstore-removeRemove .mypycache
make mypycache-removeOr to remove all above run:
make cleanupThis project is licensed under the terms of the GNU GPL v3.0 license. See LICENSE for more details.
Non mi assumo, né espressamente né tacitamente, la responsabilità per l’utilizzo di questo software.
Non sono affiliato in alcun modo a Opera o a ristoCoud™.
Questo è un progetto nato per puro svago, e in alcun modo intende recare danno o problemi, di qualsiasi natura o entità, a Opera o a ristoCoud™ o a terzi.
@misc{pyristocloud,
author = {riklus},
title = {API Wrapper per ristoCoud™ di Opera4u unitn.},
year = {2021},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/riklus/pyristocloud}}
}This project was generated with python-package-template