Python library for accessing Argo Scuola Famiglia API
Project description
Argo Famiglia API - Python Library
Una libreria Python completa per accedere programmaticamente all'API di Argo Scuola Famiglia, permettendo di ottenere voti, compiti, assenze e comunicazioni per più figli.
✨ Caratteristiche
- 🔐 Autenticazione OAuth2 PKCE sicura
- 👨👩👧👦 Supporto multi-figlio - Gestisce automaticamente più figli
- � Supporto multi-account - Consente più account genitore (multi-utente) e iterazione su tutti i figli
- �📊 Dati strutturati - Classi Python per tutti i tipi di dati
- 🛡️ Gestione errori robusta con logging dettagliato
- 📱 API moderna - Interfaccia semplice e intuitiva
- 🧪 Test-ready - Struttura modulare per testing
🚀 Installazione
Da PyPI (consigliato)
pip install argo-famiglia-api
Da sorgente
git clone https://github.com/yourusername/argo-famiglia-api.git
cd argo-famiglia-api
pip install -e .
Dipendenze
requests >= 2.25.0python-dotenv >= 0.19.0(opzionale, per supporto .env files)
📖 Utilizzo Rapido
from argo_famiglia_api import ArgoFamiglia
# Metodo 1: Prompt interattivo (raccomandato)
argo = ArgoFamiglia()
children = argo.authenticate() # Chiede credenziali in modo sicuro
# Metodo 2: Variabili d'ambiente
import os
os.environ['ARGO_SCHOOL_CODE'] = 'SCxxxxx' # Replace with your school code
os.environ['ARGO_USERNAME'] = 'genitore'
os.environ['ARGO_PASSWORD'] = 'password'
argo = ArgoFamiglia()
children = argo.authenticate() # Usa env vars
# Metodo 3: Passaggio diretto (usa solo per test)
argo = ArgoFamiglia('SCxxxxx', 'genitore', 'password') # Replace SCxxxxx with your school code
children = argo.get_children()
# Usa i dati
for child in children:
grades = argo.get_grades(child.token)
assignments = argo.get_assignments(child.token)
absences = argo.get_absences(child.token)
for child in children: print(f"Elaborando dati per {child.full_name}")
# Voti
grades = argo.get_grades(child.token)
# Compiti
assignments = argo.get_assignments(child.token)
# Assenze
absences = argo.get_absences(child.token)
## � Multi-account (multi-utente)
La libreria supporta più account genitore / multipli set di credenziali.
Questo è utile quando più persone (es. mamma e papà) vogliono accedere agli stessi figli.
```python
from argo_famiglia_api import ArgoFamiglia
accounts = [
{"school_code": "SCxxxxx", "username": "parent1", "password": "secret1"},
{"school_code": "SCxxxxx", "username": "parent2", "password": "secret2"},
]
all_children = ArgoFamiglia.authenticate_multiple(accounts)
print(f"Trovati {len(all_children)} figli in totale")
�📚 Documentazione API
Classe ArgoFamiglia
Classe principale per l'interazione con l'API.
Metodi
get_children()- Restituisce lista di oggettiChildget_grades(token)- Restituisce lista di oggettiGradeget_assignments(token)- Restituisce lista di oggettiAssignmentget_absences(token)- Restituisce lista di oggettiAbsence
Modelli Dati
Child
@dataclass
class Child:
id: str
name: str
surname: str
class_name: str
token: str
@property
def full_name(self) -> str: ...
Grade
@dataclass
class Grade:
subject: str
grade: str
date: str
type: str
teacher: str
notes: Optional[str] = None
Assignment
@dataclass
class Assignment:
subject: str
description: str
date: str
teacher: str
Absence
@dataclass
class Absence:
date: str
type: str
justified: bool
hours: int
🎯 Esempio Completo
from argo_famiglia_api import ArgoFamiglia
from argo_famiglia_api.utils import format_grades_table
# Credenziali (sostituisci con le tue!)
SCHOOL_CODE = "SCxxxxx" # Replace with your school code
USERNAME = "genitore"
PASSWORD = "password"
def main():
argo = ArgoFamiglia(SCHOOL_CODE, USERNAME, PASSWORD)
try:
# Autenticazione e ottenimento figli
children = argo.get_children()
print(f"Trovati {len(children)} figli")
# Elabora ogni figlio
for child in children:
print(f"\n=== {child.full_name} ({child.class_name}) ===")
# Voti
grades = argo.get_grades(child.token)
if grades:
print("\n📊 ULTIMI VOTI:")
print(format_grades_table(grades))
# Compiti
assignments = argo.get_assignments(child.token)
if assignments:
print(f"\n📝 COMPITI: {len(assignments)} totali")
for assignment in assignments[:3]:
print(f" • {assignment}")
# Assenze
absences = argo.get_absences(child.token)
if absences:
print(f"\n🏫 ASSENZE: {len(absences)} totali")
unjustified = [a for a in absences if not a.justified]
if unjustified:
print(f" ⚠️ Da giustificare: {len(unjustified)}")
except Exception as e:
print(f"Errore: {e}")
if __name__ == "__main__":
main()
🔧 Configurazione Sicura
Variabili d'Ambiente
export ARGO_SCHOOL_CODE="SCxxxxx" # Replace with your school code
export ARGO_USERNAME="genitore"
export ARGO_PASSWORD="password"
import os
argo = ArgoFamiglia(
school_code=os.getenv("ARGO_SCHOOL_CODE"),
username=os.getenv("ARGO_USERNAME"),
password=os.getenv("ARGO_PASSWORD")
)
File di Configurazione
# config.py
ARGO_CONFIG = {
"school_code": "SCxxxxx",
"username": "genitore",
"password": "password"
}
🧪 Testing
# Installa dipendenze di sviluppo
pip install -e ".[dev]"
# Esegui test
pytest
# Con coverage
pytest --cov=argo_famiglia_api
📋 Endpoints Supportati
- ✅
votigiornalieri- Voti giornalieri - ✅
compiti- Compiti assegnati - ✅
assenze- Registro assenze - ✅
comunicazioni- Comunicazioni scuola - ✅
note- Note disciplinari - ✅
orario- Orario scolastico
🔒 Sicurezza
IMPORTANTE: Questa libreria non memorizza mai le credenziali nel codice sorgente.
Metodi di Autenticazione (in ordine di sicurezza)
-
� File segreto JSON (Raccomandato)
- Crea un file
.argo_credentials.json(o impostaARGO_CREDENTIALS_FILE) con:{ "school_code": "SCxxxxx", "username": "genitore", "password": "password" }
- Assicurati che il file sia ignorato da Git (
.gitignoreinclude ".env" per default, aggiungi anche.argo_credentials.jsonse serve).
- Crea un file
-
🌍 Variabili d'Ambiente
export ARGO_SCHOOL_CODE="SCxxxxx" export ARGO_USERNAME="genitore" export ARGO_PASSWORD="password"
-
🔐 Prompt Interattivo (se non trovi credenziali altrove)
argo = ArgoFamiglia() children = argo.authenticate() # Chiede credenziali al momento
-
⚠️ Passaggio Diretto (Solo per test locali)
argo = ArgoFamiglia('SCxxxxx', 'user', 'pass') # Replace SCxxxxx with your school code
Best Practices di Sicurezza
- ✅ Mai hardcodare credenziali nel codice
- ✅ Usare env vars per deployment
- ✅ Prompt interattivo per uso manuale
- ✅ Non committare file con credenziali
- ✅ Usare .env files locali (ignorati da git)
🤝 Contributi
Contributi benvenuti! Per favore:
- Fork il repository
- Crea un branch per la tua feature (
git checkout -b feature/AmazingFeature) - Commit le tue modifiche (
git commit -m 'Add some AmazingFeature') - Push al branch (
git push origin feature/AmazingFeature) - Apri una Pull Request
📄 Licenza
Questo progetto è distribuito sotto licenza MIT. Vedi il file LICENSE per dettagli.
⚠️ Disclaimer
Questa libreria è un progetto indipendente e non è affiliata con Argo Software o istituti scolastici. Utilizzala responsabilmente e in conformità con i termini di servizio di Argo Scuola Famiglia.
📞 Supporto
- 🐛 Issues
- 💬 Discussions
Sviluppato con ❤️ per la comunità educativa
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argo_famiglia_api-1.0.1-py3-none-any.whl.
File metadata
- Download URL: argo_famiglia_api-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0e6c78f257347a504151b610231d7cfb395bb9f3fa115d17d68b8a3175dcf46
|
|
| MD5 |
fb1c315b4fb6840b788ee42d69623c48
|
|
| BLAKE2b-256 |
7ddb7974e79879f6f4a24d84c1d4cbfcfb65a1ce0dc030bd66c3ecfe2dd155c7
|