-
Notifications
You must be signed in to change notification settings - Fork 0
Python Library
denys.kramar edited this page Jul 9, 2025
·
2 revisions
Python port of the Kotlin library with identical functionality for GBL file manipulation.
pip install gbl-ninja==1.0.0from gbl import Gbl
from results.parse_result import ParseResult
gbl_parser = Gbl()
result = gbl_parser.parse_byte_array(gbl_data)
if isinstance(result, ParseResult.Success):
print(f"Successfully parsed {len(result.result_list)} tags")
# Process tags
else:
print(f"Parse failed: {result.error}")builder = Gbl().GblBuilder.create()
builder.application(type_val=32, version=0x10000)
builder.prog(flash_start_address=0x1000, data=firmware_data)
gbl_bytes = builder.build_to_byte_array()with open('firmware.gbl', 'rb') as f:
gbl_data = f.read()
result = gbl_parser.parse_byte_array(gbl_data)- Complete Python implementation
- Identical API to Kotlin version
- Cross-platform compatibility
- Easy integration with Python projects