Thailand Post Track
A Python library for Thailand Post Track API
Table of Contents
Installation
pip install thailandpost-track
Usage
from thailandpost_track import ThailandpostTrack
Initial Thailand Post Track Object
Parameter:
token_keystring token to access API Get here
Function:
TOKEN_KEY = 'X5RcT/DOF@ESK_RxMICNP8PTW=Dm...'
thp = ThailandpostTrack(token_key=TOKEN_KEY)
Viewing Track
Check status of tracking
Parameter:
barcodestring list tracking number of Thailand Poststatusstring filter by statusdefaultStatusCode.ALL morelanguagestring language of responsedefaultLanguage.EN more
Function:
from thailandpost_track import Language
from thailandpost_track import StatusCode
barcode = ['EF582568151TH']
thp.track(barcode=barcode, status=StatusCode.FINAL_DELIVERY, language=Language.EN)
Response:
{
'response': {
'items': {
'EF582568151TH': [
{
'barcode': 'EF582568151TH',
'status': '501',
'status_description': 'Final delivery',
'status_date': '26/10/2019 10:00:44+07:00',
'location': 'RONG KWANG',
'postcode': '54140',
'delivery_status': 'S',
'delivery_description': 'Successful',
'delivery_datetime': '26/10/2019 10:00:44+07:00',
'receiver_name': 'ยุพิน/ภรรยา',
'signature': 'https://trackimage.thailandpost.co.th/f/signature/QDY4MTUxYjVzMGx1VDMz/QGI1c0VGMGx1VDMx/QGI1czBsVEh1VDM0/QGI1czBsdTU4MjVUMzI='
}
]
},
'track_count': {
'track_date': '24/03/2020',
'count_number': 6,
'track_count_limit': 1000
}
},
'message': 'successful',
'status': True
}
Viewing Token Expire
Check token expire
Function:
thp.expire()
Response:
2020-04-24 17:30:48+07:00
Fetch New Token
Fetch new token, if your token will expire
Function:
thp.fetch_token()
References
Status Code
Status of items. Click link to show more detail.
List:
| Variables | Code | Description |
|---|---|---|
| ALL | all | All |
| PRELOAD | 101 | Preload |
| ACCEPTED_BY_AGENT | 102 | Accepted by Agent |
| COLLECTION | 103 | Posting/Collection |
| IN_TRANSIT | 201 | In transit |
| PERFORM_CUSTOMS_CLEARANCE | 202 | Perform customs clearance |
| RETURN_TO_SENDER | 203 | Return to Sender |
| ARRIVAL_AT_OUTWARD_OFFICE | 204 | Arrival at outward office of exchange |
| ARRIVAL_AT_INWARD_OFFICE | 205 | Arrival at inward office of exchange |
| ARRIVAL_AT_POST_OFFICE | 206 | Arrival at post office |
| PREPARE_TRANSIT | 207 | Prepare transit |
| ITEM_OUT_FOR_PHYSICAL_DELIVERY | 301 | Item out for physical delivery |
| ITEM_ARRIVAL_AT_COLLECTION_POINT | 302 | Item arrival at collection point for pick-up (by recipient) |
| UNSUCCESSFUL | 401 | Unsuccessful (physical) delivery |
| FINAL_DELIVERY | 501 | Final delivery |
How to use:
from thailandpost_track import StatusCode
StatusCode.ALL
Language
Language of response.
List:
| Variables | Description |
|---|---|
| TH | Thai Language |
| EN | English Language |
| CN | Chinese Language |
How to use:
from thailandpost_track import Language
Language.EN
Metadata
Release files for thailandpost-track 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thailandpost-track-1.0.0.tar.gz | 4.3 kB | Without provenance | Details for thailandpost-track-1.0.0.tar.gz |
Release files / thailandpost-track-1.0.0.tar.gz
| Download URL | thailandpost-track-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86a72548ba02ca1b8cd7d5e564217deb239e3cae2e1d445c5fb0aaff69740bf2
|
|
BLAKE2b-256 checksum How to use checksums |
0c1252caadb644fba2c97af06fc589947546ec6b8caa8875b783d47aab71e193
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
|
Security for thailandpost-track 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.