A Python package based on ISO 6346 Container Codes.
This package provides functionalities to search for container information using ISO codes and to validate container numbers.
Install the package using pip:
pip install iso-containerYou can retrieve detailed container information using an ISO code:
from iso_container import get_container_info
# Example usage
container_info = get_container_info('22GP')
print(container_info)
# -> {'class': '20 GENERAL PURPOSE CONTAINER', 'type': 'STANDARD DRY', 'length': 20, 'height': 8.5}Validate whether a container number is compliant with the ISO 6346 standard:
from iso_container import validate_container
# Example usage
is_valid = validate_container('CSQU3054383')
print('Valid Container Number' if is_valid else 'Invalid Container Number')
# -> Valid Container Number| Function | Returns |
|---|---|
get_container_info(code) |
A dict with container details, or None if the code is unknown. The lookup is case-insensitive. |
validate_container(number) |
True if the 11-character number passes the ISO 6346 check-digit rule, otherwise False. |
The dataset used in this package is derived from the ISO-Container-Codes repository, processed to enhance usability.
This project is licensed under the MIT License.