Encode, decode, and validate 14-character TextileTag clothing codes
Project description
TextileTag Python SDK
Encode, decode, and validate 14-character TextileTag clothing codes.
Install
pip install textiletag
Usage
from textiletag import encode, decode, validate, describe
# Encode a garment
code = encode(
garment_type="TP", material="CO", wash="N", temp="C",
dry="T", color="W", size="3", iron=1, bleach=2,
dryclean=0, country="US",
)
print(code) # 01TPCONCTW3AUS
# Decode a code
result = decode("01TPCONCTW3AUS")
print(result["garment_type_label"]) # Top
print(result["material_label"]) # Cotton
# Get human-readable description
print(describe("01TPCONCTW3AUS"))
# M white cotton top. Wash: Normal, cold water. Dry: Tumble Dry. ...
# Validate a code
errors = validate("INVALID")
print(errors) # ['Must be 14 characters, got 7']
errors = validate("01TPCONCTW3AUS")
print(errors) # [] (empty = valid)
API
| Function | Description |
|---|---|
encode(...) |
Encode garment attributes into a 14-character code |
decode(code) |
Decode a code into a dictionary of fields and labels |
validate(code) |
Return a list of validation errors (empty = valid) |
describe(code) |
Return a human-readable description string |
encode_flags(iron, bleach, dryclean) |
Pack care flags into one character |
decode_flags(char) |
Unpack a care flags character |
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
textiletag-0.1.0.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textiletag-0.1.0.tar.gz.
File metadata
- Download URL: textiletag-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d10bcc9f9de84520fabb72f2ff2560b45829cdb942e8bf0bff21e316f05a161
|
|
| MD5 |
05ea4c210e9d528a514b4c5aa3c90069
|
|
| BLAKE2b-256 |
fdf0f1a5fd25ed0b9a49460cbb2ea17b98d6b5aa3aeec05b76a626e241c3d362
|
File details
Details for the file textiletag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: textiletag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ee7397b3ba59e8c879e2e79cb8acf29574d2fc12f3f8b32001a8fa0187bda4
|
|
| MD5 |
b12df8450261ca1aabd039ee1cd63ef8
|
|
| BLAKE2b-256 |
522c4d167bacce322434f11014fddbe04c05b7701c08e128db22a051ef33f357
|