note to myself : http headers does not use '_', and will be converted into '-', and by convention, should use captical letter at the first letter of each words.
@0aa9d366791b04b22955328e6994d6173cb03f95
--- inference_endpoint.py
+++ inference_endpoint.py
... | ... | @@ -112,16 +112,15 @@ |
112 | 112 |
return {"message": f"Image {self.mask} uploaded successfully!"} |
113 | 113 |
|
114 | 114 |
def send_result(self): |
115 |
- time_sent = datetime.now(self.time_zone).strftime("yyyy-MM-dd'T'HH:mm:ss'Z'") |
|
115 |
+ time_sent = datetime.now(self.time_zone).strftime("%Y-%m-%dT%H:%M:%SZ") |
|
116 | 116 |
print(str(self.flag_detected)) |
117 | 117 |
header = { |
118 |
- 'Content-Type': f'{self.image_type}', |
|
119 |
- 'x-time-sent': time_sent, |
|
120 |
- 'x-cctv-name': base64.b64encode(str(self.cctv_name).encode('utf-8')).decode('ascii'), |
|
121 |
- 'x-cctv-latitude': str(self.cctv_latitude), |
|
122 |
- 'x-cctv-longitude': str(self.cctv_longitude), |
|
123 |
- 'x-area-percentage' : str(self.area_percent), |
|
124 |
- 'x-flag_detected' : str(self.flag_detected), #"True" or "False" |
|
118 |
+ 'X-Time-Sent': time_sent, |
|
119 |
+ 'X-CCTV-Name': base64.b64encode(str(self.cctv_name).encode('utf-8')).decode('ascii'), |
|
120 |
+ 'X-CCTV-Latitude': str(self.cctv_latitude), |
|
121 |
+ 'X-CCTV-Longitude': str(self.cctv_longitude), |
|
122 |
+ 'X-Area-Percentage' : str(self.area_percent), |
|
123 |
+ 'X-Flag-Detected' : str(self.flag_detected) #"True" or "False" |
|
125 | 124 |
} |
126 | 125 |
session = requests.Session() |
127 | 126 |
|
--- postprocess_draft.py
+++ postprocess_draft.py
... | ... | @@ -132,7 +132,7 @@ |
132 | 132 |
self.time_sent = request.headers.get('x-time-sent', '') |
133 | 133 |
self.cctv_latitude = request.headers.get('x-cctv-latitude', 'Not provided') |
134 | 134 |
self.cctv_longitude = request.headers.get('x-cctv-longitude', 'Not provided') |
135 |
- self.detected = request.headers.get('x-flag_detected') |
|
135 |
+ self.detected = request.headers.get('x-flag-detected') |
|
136 | 136 |
if self.detected == "True": |
137 | 137 |
self.detected = True |
138 | 138 |
elif self.detected == "False": |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?