6. ETIQUETAS
Module: tag
Tag
Bases: MEBase
A factory for a Tag class .
This class provides methods for managing shipping tags in the MelhorEnvio API.
| METHOD | DESCRIPTION |
|---|---|
create |
Create a shipping tag. |
print_tag |
Print a shipping tag. |
preview |
Preview shipping tag data. |
search |
Search for shipping tags. |
list |
List shipping tags. |
get |
Retrieve information about a specific shipping tag. |
can_cancel |
Check if a shipping tag can be canceled. |
cancel |
Cancel a shipping tag. |
tracking |
Track a shipment associated with a shipping tag. |
create(body: dict) -> dict
Create a shipping tag.
This method allows you to create a shipping tag for a shipment.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the required information for creating the tag.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If 'body' is not a valid dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing information about the created shipping tag.
TYPE:
|
Source code in melhorenvio/resources/tag.py
print_tag(body: dict) -> dict
Print a shipping tag.
This method allows you to print a shipping tag for a previously generated shipment.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the necessary information for printing the tag.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If 'body' is not a valid dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing information about the printed shipping tag.
TYPE:
|
Source code in melhorenvio/resources/tag.py
preview(body: dict) -> dict
Preview shipping tag data.
This method allows you to preview the data for a shipping tag before generating it.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the required information for tag preview.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If 'body' is not a valid dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing the previewed shipping tag data.
TYPE:
|
Source code in melhorenvio/resources/tag.py
search(filters: dict) -> dict
Search for shipping tags.
This method allows you to search for shipping tags based on specific filters.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
filters |
A dictionary containing the filtering criteria.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If 'filters' is not a valid dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing the shipping tags that match the provided filters.
TYPE:
|
Source code in melhorenvio/resources/tag.py
list(filters: dict | None) -> dict
Retrieve shipping tags.
This method allows you to retrieve shipping tags based on specific filters if provided.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
filters |
An optional dictionary containing filtering criteria, or None for no filters.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If 'filters' is not a valid dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing the shipping tags that match the provided filters or all available tags if no filters are provided.
TYPE:
|
Source code in melhorenvio/resources/tag.py
get(order_id: str) -> dict
Retrieve information about a shipping tag.
This method allows you to retrieve detailed information about a specific shipping tag using its unique order ID.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
order_id |
The unique identifier (order ID) of the shipping tag.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing detailed information about the specified shipping tag.
TYPE:
|
Source code in melhorenvio/resources/tag.py
can_cancel(body: dict) -> dict
Check if a shipping tag can be canceled.
This method allows you to determine whether a specific shipping tag can be canceled or not based on the provided data in the request body.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the necessary data to check if the shipping tag can be canceled.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided body is not a dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary indicating whether the shipping tag can be canceled or not, along with additional information.
TYPE:
|
Source code in melhorenvio/resources/tag.py
cancel(body: dict) -> dict
Cancel a shipping tag.
This method allows you to cancel a specific shipping tag based on the provided data in the request body.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the necessary data to cancel the shipping tag.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided body is not a dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary indicating whether the shipping tag was successfully canceled or not, along with additional information.
TYPE:
|
Source code in melhorenvio/resources/tag.py
tracking(body: dict) -> dict
Track a shipment associated with a shipping tag.
This method allows you to track the shipment associated with a specific shipping tag using the provided tracking data.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing the necessary tracking data for the shipment.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided body is not a dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing tracking information for the shipment associated with the shipping tag.
TYPE:
|