shipthisapi-python 1.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ShipthisAPI/__init__.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import Dict
|
|
2
|
+
import requests
|
|
3
|
+
class ShipthisAPI:
|
|
4
|
+
base_api_endpoint = 'https://api.shipthis.co/api/v3/'
|
|
5
|
+
|
|
6
|
+
def __init__(self, base_url: str, organisation: str, x_api_key:str, user_type='employee') -> None:
|
|
7
|
+
self.x_api_key = x_api_key
|
|
8
|
+
self.organisation_id = organisation
|
|
9
|
+
self.base_url = base_url
|
|
10
|
+
self.user_type = user_type
|
|
11
|
+
|
|
12
|
+
def _make_request(self, method: str, path: str, query_params: str=None, request_data=None) -> None:
|
|
13
|
+
headers = {
|
|
14
|
+
"x-api-key": self.x_api_key,
|
|
15
|
+
"organisation_id": self.organisation_id,
|
|
16
|
+
"user_type": self.user_type
|
|
17
|
+
}
|
|
18
|
+
resp = requests.request(method, self.base_api_endpoint + path, data=request_data or {}, headers=headers)
|
|
19
|
+
if resp.status_code == 200:
|
|
20
|
+
return resp.json
|
|
21
|
+
|
|
22
|
+
def info(self) -> Dict:
|
|
23
|
+
info_resp = self._make_request('GET', 'auth/info')
|
|
24
|
+
return info_resp
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shipthisapi-python
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: ShipthisAPI utility package
|
|
5
|
+
Home-page: https://github.com/shipthisco/shipthisapi-python
|
|
6
|
+
Author: Mayur Rawte
|
|
7
|
+
Author-email: mayur@shipthis.co
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: author-email
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# ShipthisAPI Python
|
|
21
|
+
|
|
22
|
+
[](https://badge.fury.io/py/shipthisapi-python)
|
|
23
|
+
|
|
24
|
+
A Python wrapper package for ShipthisAPI for making api calls using python.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Features
|
|
28
|
+
--------
|
|
29
|
+
|
|
30
|
+
* Demo setup with ``demo.py``
|
|
31
|
+
* Simple Step API calls.
|
|
32
|
+
|
|
33
|
+
Quickstart
|
|
34
|
+
----------
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Install the latest `shipthisapi-python`
|
|
38
|
+
if you haven't installed it yet.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
pip install shipthisapi-python
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
[Generate a API Key For your Organisation](https://shipthis.crisp.help/en/article/how-to-generate-an-api-key-1qnsq1d/?bust=1633352029281)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from ShipthisAPI.shipthisapi import ShipthisAPI
|
|
49
|
+
|
|
50
|
+
x_api_key = '<your_api_key>'
|
|
51
|
+
organisation = 'demo'
|
|
52
|
+
region_id='<your_region_id>'
|
|
53
|
+
location_id='<your_location_id>'
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
shipthisapi = ShipthisAPI(organisation=organisation, x_api_key=x_api_key, region_id=region_id, location_id=location_id)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# Get Organisation/User Info
|
|
60
|
+
|
|
61
|
+
print(shipthisapi.info())
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Get Invoice Collection List
|
|
65
|
+
|
|
66
|
+
print(shipthisapi.get_list(collection_name='invoice'))
|
|
67
|
+
|
|
68
|
+
# Get all Sea list
|
|
69
|
+
|
|
70
|
+
print(shipthisapi.get_list(collection_name="sea_shipment", params={"count": 2}))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Documentation
|
|
77
|
+
-----------
|
|
78
|
+
|
|
79
|
+
For more details related to available fields and operations check our [developer portal](https://developer.shipthis.co)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
Available Operations
|
|
83
|
+
|
|
84
|
+
- Get Organisation / User Information
|
|
85
|
+
- Create New Collection Entry
|
|
86
|
+
- Update Collection
|
|
87
|
+
- Get Collection Items
|
|
88
|
+
- Delete an existing collection item
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
Support
|
|
93
|
+
------------------
|
|
94
|
+
|
|
95
|
+
If you have any queries related to usage of the api please raise a issue [here](https://github.com/shipthisco/shipthisapi-python)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ShipthisAPI/__init__.py,sha256=eEx4pJ9QtrqOUJqCNtp_u5GEehhUFSG_QpRCJNHOl2Q,93
|
|
2
|
+
ShipthisAPI/shipthisapi.py,sha256=pUQRZSEJph3eSQCf_UGqy3vv34pjNznRrBIckDi0NiI,933
|
|
3
|
+
shipthisapi_python-1.3.1.dist-info/METADATA,sha256=UEsW6QbJpjP0RUzuidz_wQdxPixMKY4Pup6rzHXTn8g,2155
|
|
4
|
+
shipthisapi_python-1.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
+
shipthisapi_python-1.3.1.dist-info/top_level.txt,sha256=35r4y5buufpRwYKMsKPB59GoDeEprokRcBpgf-PVEFg,12
|
|
6
|
+
shipthisapi_python-1.3.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ShipthisAPI
|