A Python client library for programmatic access to the Unipol Move API. Fetch toll movements and generate expense report PDFs.
- π Authentication with username/password
- π Fetch toll movements with automatic pagination
- π Generate official PDF expense reports
- ποΈ Filter movements by date range
- π Clean, typed Python API
- β‘ Minimal dependencies (only
requests)
pip install requestsThen copy unipolmove_client.py to your project or install via:
pip install git+https://github.com/yourusername/unipolmove-python.gitfrom unipolmove_client import UnipolMoveClient
from datetime import date
# Initialize client
client = UnipolMoveClient(contract_id="P000000000")
# Login
if client.login("your@email.com", "yourpassword"):
print("Login successful!")
# Fetch all movements
movements = client.fetch_all_movements(interval="ULTIMO_ANNO")
print(f"Found {len(movements)} movements")
# Filter by date range
filtered = client.filter_movements_by_date(
movements,
start_date=date(2024, 1, 1),
end_date=date(2024, 12, 31)
)
# Generate PDF report
pdf_bytes = client.generate_pdf_report(
movements=filtered,
intestatario="JOHN DOE",
output_filename="expense_report.pdf"
)
print("PDF generated successfully!")Initialize the client.
Args:
contract_id(str): Your Unipol Move contract ID (e.g., 'P000000000')mrh_session(str, optional): MRHSession cookie (if you have it already)last_mrh_session(str, optional): LastMRH_Session cookie (if you have it already)session_id(str, optional): Session ID (auto-generated if not provided)
Authenticate and obtain session cookies.
Args:
username(str): Your Unipol Move emailpassword(str): Your Unipol Move password
Returns:
bool: True if login successful, False otherwise
fetch_movements(offset=1, limit=100, interval="ULTIMO_ANNO", order_by="date-D", payment_status="0,1,3,4") -> Dict
Fetch toll movements from the API.
Args:
offset(int): Starting offset for pagination (default: 1)limit(int): Maximum records per request (default: 100)interval(str): Time interval (default: 'ULTIMO_ANNO' = last year)order_by(str): Sorting order (default: 'date-D' = date descending)payment_status(str): Payment status filter (default: '0,1,3,4')
Returns:
dict: API response with 'dispositivi' and 'listaMovimenti'
Fetch all toll movements with automatic pagination.
Args:
batch_size(int): Records per request (default: 100)interval(str): Time interval (default: 'ULTIMO_ANNO')
Returns:
list: All movements
Generate PDF expense report for selected movements.
Args:
movements(list): Movement dictionaries to includeintestatario(str): Report recipient nameoutput_filename(str, optional): Save to file if provided
Returns:
bytes: PDF file content
Filter movements by date range.
Args:
movements(list): Movement dictionariesstart_date(date): Start date (inclusive)end_date(date): End date (inclusive)
Returns:
list: Filtered movements
from unipolmove_client import UnipolMoveClient
client = UnipolMoveClient(contract_id="P000000000")
client.login("your@email.com", "password")
# Get movements
movements = client.fetch_all_movements()
for movement in movements[:5]:
print(f"{movement['dataIngresso']}: {movement['importoAddebitato']} EUR")from datetime import date
# Get movements from January 2024
movements = client.fetch_all_movements()
january_movements = client.filter_movements_by_date(
movements,
start_date=date(2024, 1, 1),
end_date=date(2024, 1, 31)
)# Generate report for specific movements
pdf_bytes = client.generate_pdf_report(
movements=january_movements,
intestatario="JOHN DOE",
output_filename="january_2024_report.pdf"
)# Fetch movements in smaller batches
page1 = client.fetch_movements(offset=1, limit=50)
page2 = client.fetch_movements(offset=51, limit=50)You can use environment variables for configuration:
import os
from unipolmove_client import UnipolMoveClient
contract_id = os.getenv("UNIPOL_CONTRACT_ID")
username = os.getenv("UNIPOL_USERNAME")
password = os.getenv("UNIPOL_PASSWORD")
client = UnipolMoveClient(contract_id=contract_id)
client.login(username, password)The client interfaces with two separate Unipol Move API endpoints:
-
Movements API: Fetches toll movement data
- Endpoint:
/api/ut/prv/unipolmove/portale-tlpd/servizi-mobilita/v6/contratti/{contract_id}/movimenti
- Endpoint:
-
PDF Generation API: Generates expense report PDFs
- Endpoint:
/api/us/prv/tpd/telepedaggio-us/post-vendita/v1/contratti/{contract_id}/movimenti/stampa
- Endpoint:
Both endpoints require authentication via session cookies obtained through the login flow.
- Python 3.8+
requestslibrary
- Never commit credentials to version control
- Use environment variables for sensitive data
- Session cookies are stored in memory only
- API credentials are embedded in the client (required for IBM API Gateway)
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
This is an unofficial client library. It is not affiliated with or endorsed by Unipol Move or UnipolSai Assicurazioni S.p.A.
Use at your own risk. The API endpoints and authentication mechanisms were reverse-engineered and may change without notice.
This library was created to simplify expense reporting workflows for Unipol Move users.