A python library to consult your SemParar data such as invoice, invoice total price, registered bank account, etc.
To use this library, it is necessary to install the following packages:
- Python 2
- Python argparse
- Python automatedweb - https://github.com/renanleonellocastro/automatedweb
- Python datetime
- Python xml.etree
- Python prettytable
To use this library you need to know your registered CPF and PASSWORD in the SemParar's system. You can debug the library using the "debug=True" option in the library constructor.
Using this library you can get the following information from your SemParar's toll system:
- Name
- Invoice Due Date
- Mobile Number
- Client Code
- Number of Registered Vehicles
- Blocked Account
- Vehicle Name
- Vehicle Plate Number
- Registered Bank Account
- Address
- Current Invoice Extract
- Current Invoice Total Price
- Last 3 Months Invoice Extract
- Last 3 Months Invoice Total Price
from semparar import SemParar
sem_parar = SemParar(cpf="12312312312", password="123123", simulate=False, debug=False)
name = sem_parar.name
due_date = sem_parar.due_date
email = sem_parar.email
mobile_number = sem_parar.mobile_number
client_code = sem_parar.client_code
number_of_vehicles = sem_parar.number_of_vehicles
blocked = sem_parar.blocked
vehicle_name = sem_parar.vehicle_name
vehicle_plate_number = sem_parar.vehicle_plate_number
bank_account = sem_parar.bank_account
bank_name = bank_account['bank_name']
bank_unit_name = bank_account['bank_unit_name']
bank_unit_number = bank_account['bank_unit_number']
bank_account_number = bank_account['account_number']
bank_account_digit = bank_account['account_digit']
address = sem_parar.address
city = address['city']
state = address['state']
place_name = address['place_name']
place_number = address['place_number']
neighborhood = address['neighborhood']
zip_code = address['zip_code']
invoice = sem_parar.invoice
for item in invoice:
description = item['description']
place_name = item['place_name']
value = item['value']
invoice_total_price = sem_parar.invoice_total_price
for month in [02, 01, 12]:
sem_parar.change_invoice_month(month)
invoice = sem_parar.invoice
for item in invoice:
description = item['description']
place_name = item['place_name']
value = item['value']
for month in [02, 01, 12]:
sem_parar.change_invoice_month(month)
invoice_total_price = sem_parar.invoice_total_price
In this repository there is a "sample_app" directory that contains a simple example on how to use the 'SemParar API' library.
renan@computer:~/semparar_api/sample_app$ python2 sample_app.py -h
usage: semparar [-h] [-t] [-e] [-m MONTH] [-d] config
positional arguments:
config Xml file with configuration data.
optional arguments:
-h, --help show this help message and exit
-t, --total Show the total invoice value.
-e, --extract Show the invoice extract.
-m MONTH, --month MONTH
Month to get the invoice
-d, --debug Execute in debug mode.
It is necessary to fill your credentials on the sample.xml file to be able to connect to the SemParar's tolls system.
Substitute the following tags on "sample_app/sample.xml" in your local directory:
- <cpf>32167592303</cpf> -> <cpf>xxxxxxxxxxx</cpf> (xxxxxxxxxxx = your cpf number)
- <password>exemplo123</password>-> <password>xxxx</password> (xxxx = your SemParar's password)
To execute the sample above to get the invoice extract, write the following in your terminal:
python2 sample_app.py -e
To execute the sample above to get the invoice total price, write the following in your terminal:
python2 sample_app.py -t
- Add option to change month in the sample_app
- Fill the README.md with samples using different months in sample_app
- Add the data in each invoice item
- Test and fix the app for accounts with more than one vehicle
- Add unit tests
- Complete the documentation with more samples