Skip to main content

Wrapper Python (sync + async) per le API non documentate del registro elettronico DiDUP / Argo Famiglia

Project description

didupwrapper

Wrapper Python open-source (sync + async) per le API non documentate del registro elettronico DiDUP / Argo Famiglia.

Le API non sono pubbliche né documentate da Argo. Questa libreria è basata su reverse-engineering del traffico dell'app. Usala in modo responsabile e solo con le tue credenziali.

Il login usa il vero flusso OAuth2/PKCE dell'app DidUP Famiglia. L'header argo-client-version deve combaciare con l'ultima versione dell'app sugli store (attualmente 1.29.2): se diventa obsoleto il server risponde 410.

Caratteristiche

  • Python 3.10+
  • Client async (DiDUPClient) e sync (DiDUPClientSync)
  • Modelli Pydantic v2 con alias camelCase automatici
  • Eccezioni tipizzate: AuthError, RateLimitError, NotFoundError, DiDUPError
  • Worker DashboardPoller per ricevere notifiche di novità (voti, bacheca, ...)
  • Packaging con hatchling + pyproject.toml

Installazione

pip install didupwrapper

Uso rapido

Async

import asyncio
from didupwrapper import DiDUPClient

async def main():
    async with DiDUPClient("SC12345", "mario.rossi", "password") as didup:
        print("Media:", await didup.get_media_generale())
        for voto in await didup.get_voti():
            print(voto.des_materia, voto.cod_codice)

asyncio.run(main())

Sync

from didupwrapper import DiDUPClientSync

with DiDUPClientSync("SC12345", "mario.rossi", "password") as didup:
    for voto in didup.get_voti():
        print(voto.des_materia, voto.cod_codice)

Suggerimento: non mettere mai le credenziali in chiaro nel codice. Usa le variabili d'ambiente, ad esempio os.environ["DIDUP_PASSWORD"].

Versione client (argo-client-version)

Tre modi, in ordine di priorità:

# 1) Versione fissa di default (1.29.2)
DiDUPClient("SC12345", "user", "pwd")

# 2) Versione fissa esplicita
DiDUPClient("SC12345", "user", "pwd", version="1.29.2")

# 3) Auto-rilevamento dall'App Store al login (sempre aggiornata)
DiDUPClient("SC12345", "user", "pwd", auto_versione=True)

Puoi anche solo interrogare lo store:

from didupwrapper import recupera_versione_app
print(await recupera_versione_app())  # es. "1.29.2"

Metodi principali

Tutti disponibili sia sul client async (con await) che su quello sync:

Metodo Ritorna
get_dashboard() DashboardResponse (dati aggregati)
get_voti() list[Voto]
get_assenze() list[EventoAppello]
get_registro() list[RegistroLezione]
get_bacheca() list[ComunicazioneBacheca]
get_bacheca_alunno() list[FileBachecaAlunno]
get_promemoria() list[Promemoria]
get_fuori_classe() list[FuoriClasse]
get_note_disciplinari() list[NotaDisciplinare]
get_materie() list[Materia]
get_docenti() list[Docente]
get_periodi() list[Periodo]
get_prenotazioni() list[Prenotazione]
get_media_generale() float | None

Endpoint con filtri

Il client async espone anche oggetti endpoint con metodi di filtro:

await didup.voti.per_materia(101)
await didup.voti.media_per_materia(101)
await didup.assenze.da_giustificare()
await didup.bacheca.da_leggere()
await didup.registro.compiti()
await didup.fuori_classe.online()

Monitoraggio (poller)

from didupwrapper.workers import DashboardPoller

async def on_voti(nuovi):
    for v in nuovi:
        print("Nuovo voto:", v.des_materia, v.cod_codice)

poller = DashboardPoller(didup, intervallo=600, on_nuovi_voti=on_voti)
await poller.start()   # ferma con poller.stop()

Licenza

MIT — vedi LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

didupwrapper-0.1.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

didupwrapper-0.1.1-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file didupwrapper-0.1.1.tar.gz.

File metadata

  • Download URL: didupwrapper-0.1.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for didupwrapper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d6a9d66fc14d6ff589b4667ee9625e244304aa9e2b7e976b03bb5ab46a6977c3
MD5 c0c8e8328672815efa40a906a682bb60
BLAKE2b-256 e0cb3657bf9dcfd88108817cb8b0c0835bbb4b4539054cac57ab62116cc41299

See more details on using hashes here.

File details

Details for the file didupwrapper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: didupwrapper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for didupwrapper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75c7fbf34f31d925c208e22b9419acaef041e97283f53d2fe1f29cdf5907cd67
MD5 1d824a0e9954e41ce7c7032ee4be1d82
BLAKE2b-256 c9d8acffd7817ef1a27e02910dbd3d9ecdf9592f376e8dbe6ea8ccce52b990c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page