Skip to content

Commit a6e94de

Browse files
committed
first commit
1 parent 7221196 commit a6e94de

23 files changed

+593
-2
lines changed

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Python specific
2+
__pycache__/
3+
*.pyc
4+
5+
# Virtual Environment
6+
venv/
7+
env/
8+
bin/
9+
lib/
10+
include/
11+
*.egg-info/
12+
.installed.cfg
13+
.Python
14+
build/
15+
develop-eggs/
16+
.installed.cfg
17+
downloads/
18+
parts/
19+
var/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
*.db
24+
*.sqlite3
25+
*.sqlite
26+
27+
# IDEs
28+
.idea/
29+
30+
# Jupyter Notebook
31+
.ipynb_checkpoints/
32+
33+
# Logs and databases
34+
*.log
35+
*.sql
36+
*.sqlite
37+
38+
# OS generated files
39+
.DS_Store
40+
Thumbs.db
41+
42+
# Editors
43+
*.swp
44+
*.swo
45+
46+
# Environment config
47+
.env

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 TrackingMore
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
# trackingmore-sdk-python
2-
The Python SDK of Trackingmore API
1+
trackingmore-sdk-python
2+
=================
3+
4+
The Python SDK of
10.9 KB
Binary file not shown.

dist/trackingmore-0.1.0.tar.gz

7.37 KB
Binary file not shown.

example/air_waybill_example.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import trackingmore
2+
3+
trackingmore.api_key = 'you api key'
4+
5+
def create_an_air_waybill(params):
6+
try:
7+
result = trackingmore.air_waybill.create_an_air_waybill(params)
8+
return result
9+
except trackingmore.exception.TrackingMoreException as ce:
10+
print(ce)
11+
12+
if __name__ == '__main__':
13+
params = {'awb_number': '235-69030430'}
14+
result = create_an_air_waybill(params)
15+
print(result)

example/courier_example.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import trackingmore
2+
3+
trackingmore.api_key = 'you api key'
4+
5+
def get_all_couriers():
6+
try:
7+
result = trackingmore.courier.get_all_couriers()
8+
return result
9+
except trackingmore.exception.TrackingMoreException as ce:
10+
print(ce)
11+
12+
def detect(params):
13+
try:
14+
result = trackingmore.courier.detect(params)
15+
return result
16+
except trackingmore.exception.TrackingMoreException as ce:
17+
print(ce)
18+
19+
if __name__ == '__main__':
20+
result = get_all_couriers()
21+
print(result)
22+
23+
params = {'tracking_number': '92612903029511573030094547'}
24+
result = detect(params)
25+
print(result)

example/tracking_example.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import trackingmore
2+
3+
trackingmore.api_key = 'you api key'
4+
5+
def create_tracking(params):
6+
try:
7+
result = trackingmore.tracking.create_tracking(params)
8+
return result
9+
except trackingmore.exception.TrackingMoreException as ce:
10+
print(ce)
11+
12+
def get_tracking_results(params):
13+
try:
14+
result = trackingmore.tracking.get_tracking_results(params)
15+
return result
16+
except trackingmore.exception.TrackingMoreException as ce:
17+
print(ce)
18+
19+
def batch_create_trackings(params):
20+
try:
21+
result = trackingmore.tracking.batch_create_trackings(params)
22+
return result
23+
except trackingmore.exception.TrackingMoreException as ce:
24+
print(ce)
25+
26+
def update_tracking_by_id(id_string, params):
27+
try:
28+
result = trackingmore.tracking.update_tracking_by_id(id_string, params)
29+
return result
30+
except trackingmore.exception.TrackingMoreException as ce:
31+
print(ce)
32+
33+
def delete_tracking_by_id(id_string):
34+
try:
35+
result = trackingmore.tracking.delete_tracking_by_id(id_string)
36+
return result
37+
except trackingmore.exception.TrackingMoreException as ce:
38+
print(ce)
39+
40+
def retrack_tracking_by_id(id_string):
41+
try:
42+
result = trackingmore.tracking.retrack_tracking_by_id(id_string)
43+
return result
44+
except trackingmore.exception.TrackingMoreException as ce:
45+
print(ce)
46+
47+
if __name__ == '__main__':
48+
params = {'tracking_number': '92612903029511573030094547','courier_code':'usps'}
49+
result = create_tracking(params)
50+
print(result)
51+
52+
# params = {'tracking_numbers': '92612903029511573030094547', 'courier_code': 'usps'}
53+
# params = {'tracking_numbers': '92612903029511573030094547,92612903029511573030094548', 'courier_code': 'usps'}
54+
params = {'created_date_min': '2023-08-23T14:00:00+08:00', 'created_date_max': '2023-08-23T15:04:00+08:00'}
55+
result = get_tracking_results(params)
56+
print(result)
57+
58+
params = [{'tracking_number': '92612903029511573030094593', 'courier_code': 'usps'},
59+
{'tracking_number': '92612903029511573030094594', 'courier_code': 'usps'}]
60+
result = batch_create_trackings(params)
61+
print(result)
62+
63+
params = {'customer_name': 'New name', 'note': 'New tests order note'}
64+
id_string = "9a2f732e29b5ed2071d4cf6b5f4a3d19"
65+
result = update_tracking_by_id(id_string, params)
66+
print(result)
67+
68+
id_string = "9a2f7d1e8b912b729388c5835c188c28"
69+
result = delete_tracking_by_id(id_string)
70+
print(result)
71+
72+
id_string = "9a2f732e29b5ed2071d4cf6b5f4a3d19"
73+
result = retrack_tracking_by_id(id_string)
74+
print(result)

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[tool.poetry]
2+
name = "trackingmore"
3+
version = "0.1.0"
4+
description = "The Python SDK of Trackingmore API"
5+
authors = ["TrackingMore <manage@trackingmore.org>"]
6+
readme = "README.md"
7+
homepage = "https://www.trackingmore.com/docs/trackingmore/d5ac362fc3cda-api-quick-start"
8+
repository = "https://github.com/TrackingMores/trackingmore-sdk-python"
9+
documentation = "https://github.com/TrackingMores/trackingmore-sdk-python"
10+
keywords = ["trackingmore", "api", "tracking"]
11+
12+
packages = [
13+
{ include = "trackingmore" },
14+
{ include = "*.md" },
15+
{ include = "LICENSE" },
16+
]
17+
18+
[tool.poetry.dependencies]
19+
python = "^3.7"
20+
requests = "^2.31.0"
21+
22+
[tool.poetry.dev-dependencies]
23+
pytest = "^7.4.2"
24+
25+
26+
[build-system]
27+
requires = ["poetry-core"]
28+
build-backend = "poetry.core.masonry.api"

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import trackingmore
2+
3+
trackingmore.api_key = 'you api key'

0 commit comments

Comments
 (0)