UN Numbers
albert.collections.un_numbers.UnNumberCollection
Bases: BaseCollection
Look up UN Numbers in the Albert platform.
A UN Number is the four-digit United Nations identifier assigned to a
hazardous material for transport (e.g. UN1090 for acetone). In Albert,
UN Numbers carry the associated shipping and storage-class metadata used when
classifying substances and inventory items for shipping. Use this collection
to look them up by ID or name.
This collection is accessed as client.un_numbers.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for UN Number requests. |
Methods:
| Name | Description |
|---|---|
get_by_id |
Get a single UN Number by its ID. |
get_by_name |
Get a UN Number by its exact name, or None if not found. |
get_all |
Iterate over UN Numbers, optionally filtered by name. |
create |
Not supported; UN Numbers cannot be created through the SDK. |
Note
Creating UN Numbers is not supported via the SDK, as UN Numbers are highly controlled by Albert.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/un_numbers.py
create
Not supported; UN Numbers cannot be created through the SDK.
UN Numbers are highly controlled by Albert and are managed centrally, so this method always raises.
Returns:
| Type | Description |
|---|---|
None
|
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always, because UN Numbers cannot be created through the SDK. |
Source code in src/albert/collections/un_numbers.py
get_by_id
Get a single UN Number by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The Albert ID of the UN Number to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
UnNumber
|
The fully populated UN Number. |
Source code in src/albert/collections/un_numbers.py
get_by_name
Get a UN Number by its exact name.
Runs an exact-match lookup and returns the first result. To browse or
do partial-name matching, use get_all.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The exact name of the UN Number to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
UnNumber | None
|
The matching UN Number, or None if no exact match is found. |
Source code in src/albert/collections/un_numbers.py
get_all
get_all(
*,
name: str | None = None,
exact_match: bool = False,
start_key: str | None = None,
max_items: int | None = None,
) -> Iterator[UnNumber]
Iterate over UN Numbers, optionally filtered by name.
Results are returned as a lazily paginated iterator, so iterating fetches
additional pages on demand. With no name, iterates over all UN Numbers.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Filter to UN Numbers whose name matches. Combine with |
None
|
exact_match
|
bool
|
When True, return only exact name matches. Default False. |
False
|
start_key
|
str
|
Pagination key of the first record to evaluate; used to resume paging. |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
Yields:
| Type | Description |
|---|---|
Iterator[UnNumber]
|
The UN Numbers matching the search criteria. |