biip.gln

Global Location Number (GLN).

GLNs are used to identify physical locations, digital locations, legal entities, and organizational functions.

If you only want to parse GLNs, you can import the GLN parser directly.

>>> from biip.gln import Gln

If parsing succeeds, it returns a Gln object.

>>> gln = Gln.parse("1234567890128")
>>> gln
Gln(value='1234567890128', prefix=GS1Prefix(value='123',
usage='GS1 US'), payload='123456789012', check_digit=8)

As GLNs do not appear independently in barcodes, the GLN parser is not a part of the top-level parser biip.parse(). However, if you are parsing a barcode with GS1 element strings including a GLN, the GLN will be parsed and validated using the Gln class.

>>> import biip
>>> biip.parse("4101234567890128").gs1_message.get(data_title="SHIP TO").gln
Gln(value='1234567890128', prefix=GS1Prefix(value='123',
usage='GS1 US'), payload='123456789012', check_digit=8)
class biip.gln.Gln(value, prefix, payload, check_digit)

Dataclass containing a GLN.

value: str

Raw unprocessed value.

prefix: Optional[biip.gs1._prefixes.GS1Prefix]

The GS1 prefix, indicating what GS1 country organization that assigned code range.

payload: str

The actual payload, including extension digit, company prefix, and item reference. Excludes the check digit.

check_digit: int

Check digit used to check if the SSCC as a whole is valid.

classmethod parse(value)

Parse the given value into a Gln object.

Parameters

value (str) – The value to parse.

Return type

Gln

Returns

GLN data structure with the successfully extracted data. The checksum is guaranteed to be valid if a GLN object is returned.

Raises

ParseError – If the parsing fails.

as_gln()

Format as a GLN.

Return type

str