Skip to main content

ONE Record with Python

Project description

ONE Record with Python

Made with love for Digital Cargo GitHub Python Version Code style: black

Note: This library is based on the latest IATA ONE Record ontology (working draft)


What is ONE Record?

ONE Record is a standard for data sharing and creates a single record view of the shipment. This standard defines a common data model for the data that is shared via standardized and secured web API. (Source: IATA - ONE Record)


Requirements

  • Python version 3.9+

Installation

Install, upgrade and uninstall ONE Record with Python with these commands::

$ pip install onerecord
$ pip install --upgrade onerecord
$ pip uninstall onerecord

A Simple Example

from onerecord.models.cargo import Piece
from onerecord.client import ONERecordClient

piece = Piece(**{'company_identifier': 'cgnbeerbrewery',
                         'goods_description': 'six pack of Koelsch beer',
                         'gross_weight': {'unit': 'KGM', 'value': 3.922}})

piece.goods_description
#> 'six pack of Koelsch beer'
print(piece.json(exclude_none=True, by_alias=True))
#> {"@type": "https://onerecord.iata.org/Piece", "https://onerecord.iata.org/LogisticsObject#companyIdentifier": "cgnbeerbrewery", "https://onerecord.iata.org/Piece#goodsDescription": "six pack of Koelsch beer", "https://onerecord.iata.org/Piece#grossWeight": {"@type": "https://onerecord.iata.org/Value", "https://onerecord.iata.org/Value#unit": "KGM", "https://onerecord.iata.org/Value#value": 3.922}}
print(type(piece))
#> <class 'onerecord.models.cargo.Piece'>
print(type(piece.gross_weight))
#> <class 'onerecord.models.cargo.Value'>

client = ONERecordClient(host="localhost", port=8080, company_identifier="cgnbeerbrewery")
piece = client.create_logistics_object(piece)
print(piece.id)
#> http://localhost:8080/companies/cgnbeerbrewery/los/piece-1067358949

ONE Record Version Support

ONE Record with Python IATA Data Model Ontology IATA API Ontology IATA API Spec
v0.2.0 v2.0.0 v1.1 v1.1
... ... ... ...
... ... ... ...

Dependencies

This ONE Record with Python distribution is tested on Python 3.9 and 3.10.

The dependencies are:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onerecord-0.2.0.tar.gz (42.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onerecord-0.2.0-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file onerecord-0.2.0.tar.gz.

File metadata

  • Download URL: onerecord-0.2.0.tar.gz
  • Upload date:
  • Size: 42.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for onerecord-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b62c411c2086ece9912439b56ec5acd03356e3df28ea800c17c911a20965ea9
MD5 296093ff7bf57cfca545ba27d02ce208
BLAKE2b-256 d0346a1ed3e31167a8e93127de4535d2d72118b3623ac805f0782fd604b225fc

See more details on using hashes here.

File details

Details for the file onerecord-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: onerecord-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for onerecord-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a3aed284f278070982e8705dd5ee647459a880e2694934bb903b91231a8c4f1
MD5 9436cec40d2e774b01cbb3c84c16ce38
BLAKE2b-256 e4f3c87cbf59da4d000c0f07581a2595dedecca29bee33a453f7c86ca9b19eb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page