Fast-Weigh Ticket Integrator
Last updated
Last updated
The Fast-Weigh Ticket Integrator uses 32-bit ODBC connections to query compatible databases and post tickets to the Fast-Weigh API. It syncs tickets every 3 minutes.
The API will create/update/void any of the tickets posted.
Create config.json
file in the same directory as the .exe and set the api_key
and dsn
vars
Create tickets.sql
file in the same directory as the .exe
Set FastWeighTicketIntegrator.exe to run at startup. (Run shell:startup
via Windows Run. Copy a shortcut to the .exe into the startup directory.)
Done!
Your directory should look like:
Once the exe runs you'll also have some logs / debug files:
You can write your own ODBC connection string in the "dsn" option, or use a 32-bit system DSN by name (preferred).
If you're using the endpoint url https://api.fast-weigh.com/v3/tickets or https://api.fast-weigh.com/v2/tickets, set the api_auth_method
to "api-key".
If you're using the endpoint url https://fwticketapi.azurewebsites.net/ticket, set the api_auth_method
to "bearer".
The tickets.sql
file should conform to the FW API ticket payload body.
It is a simple text file with only the sql statement in it.
Field names should be renamed to match the keys in the ticket payload.
Sub-fields like the Region fields, Customer fields, etc... should be formated with underscores. Doing so will allow the program to parse the fields and nest them to match the format expected by the API endpoint.
A shortened example from the Libra dataset:
The above results in the following payload object:
Note: In some cases, the nesting will go 2 or 3 levels deep. Truck_Hauler_HaulerID
for example.
Here's a starter script for a Libra Access DB:
32-bit Python. Many of these old databases are only compatible with 32-bit applications/drivers.
pyodbc requires Microsoft C++ Build Tools. The easiest way to get this is via the Visual Studio Installer.
Create virtual env: py -m venv venv
(make sure you activate the env as well)
Install requirements: pip install -r requirements.txt
Dev command: py main.py
Build command: py build.py