Skip to main content

Python SDK and CLI tool for Activesoft Siga automation

Project description

Activesoft Siga CLI

A Python SDK and CLI tool for automating interactions with the Activesoft Siga API. This tool simplifies retrieval of student data (including enrollment and presence permissions), responsible party data, class lists, and sending messages.

Installation

Install via pip:

pip install activesoft-cli

Or from source:

git clone https://github.com/tsuriu/activesoft-cli.git
cd activesoft-cli
pip install .

CLI Usage

The package includes a command-line interface activesoft-cli.

Configuration

You can provide credentials via flags or environment variables:

  • --username / SIGA_USERNAME
  • --password / SIGA_PASSWORD
  • --instituicao / SIGA_INSTITUICAO

The CLI automatically saves your session (cookies) to a local JSON file: ~/.activesoft_siga_<instituicao>_<username>.json

Subsequent commands will reuse this session, avoiding full re-authentication. If the session expires, the CLI will automatically attempt to re-login.

[!TIP] Multi-User Support: The session is isolated by username and instituicao. This allows running multiple instances for different users on the same machine without session interference.

You can also specify a custom session path when using the SDK:

client = SigaClient(..., session_path="/path/to/session.json")

Commands

Student Management (students)

Lists students or retrieves complete profile details for a specific student, including associated classes (turmas) and presence management/exit permissions.

# List students (defaults to 10)
activesoft-cli students --limit 20

# Fetch complete profile for a specific student ID
# Returns a merged JSON with student data, enrollment (turmas), and presence permissions
activesoft-cli students --id 4907

Class Management (turmas)

Lists available classes/groups.

# List classes (defaults to 10)
activesoft-cli turmas --limit 5 --periodo 14

Responsible Parties (responsaveis)

Lists responsible parties or retrieves specific details.

# List responsible parties (defaults to 21)
activesoft-cli responsaveis --limit 10

# Fetch details for a specific responsible party ID
activesoft-cli responsaveis --id 10188

Messaging (send-message)

Sends a message through the Siga system.

activesoft-cli send-message \
  --student-id 4907 \
  --destinatario-id 13578 \
  --message "Your message here" \
  --title "Aviso"

Avatar/Photo Management (upload-avatar)

Uploads a new photo/avatar for a specific student.

activesoft-cli upload-avatar \
  --student-id 4907 \
  --image-path "./photos/4907.jpg"

Bulk Photo Retrieval (bulk-fotos)

Retrieves photo URLs (S3 links) for multiple students or responsible parties at once.

# Using a comma-separated list for students (default)
activesoft-cli bulk-fotos --ids "104,106,107,111"

# Or using multiple ID flags for responsible parties
activesoft-cli bulk-fotos --id 13578 --id 12354 --tipo responsavel

SDK Usage

You can use the SigaClient directly in your Python applications.

Initialization

import asyncio
import json
from activesoft_cli import SigaClient

async def main():
    # Initialize and login
    client = SigaClient(
        username="your-username", 
        password="your-password", 
        instituicao="YOUR_INSTITUTION"
    )

    async with client: # Closes session automatically
        if await client.login():
            # Get complete student profile
            aluno_detail = await client.get_aluno_detail(4907)
            aluno_info = aluno_detail.get('aluno', {})
            
            # Fetch and merge enrollment/turmas
            aluno_info['turmas'] = await client.get_aluno_turmas(4907)
            
            # Fetch and merge presence permissions
            aluno_info['gestao_presenca'] = aluno_detail.get('gestao_presenca', {})
            
            print(json.dumps(aluno_info, indent=2))

if __name__ == "__main__":
    asyncio.run(main())

Requirements

  • Python 3.8+
  • httpx
  • loguru
  • click

License

This project is licensed under the MIT 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

activesoft_cli-0.5.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

activesoft_cli-0.5.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file activesoft_cli-0.5.1.tar.gz.

File metadata

  • Download URL: activesoft_cli-0.5.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for activesoft_cli-0.5.1.tar.gz
Algorithm Hash digest
SHA256 8a0bc62f52407e10d6e097fc90d9b688c609fa4bcaf26c785f32e4432a35195d
MD5 42d93bf22245b34aeb242fca22092e8c
BLAKE2b-256 7ac8912b6db431f0111e4113b1732036c1bf3aa0e3d11b9b48b3d101c09f30cb

See more details on using hashes here.

File details

Details for the file activesoft_cli-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: activesoft_cli-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for activesoft_cli-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad1ee284ad0745303cde9bca80618b1e34ad8d0c89cad32e0bed9ae95a6caf5
MD5 abcf11878f788436a40ebf8a26578506
BLAKE2b-256 d332fbc2ef63e3bc0aa68b0ed13294efa2f20dde392246cb63977f555d9912b9

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