윤영준 윤영준 05-24
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
+++ inference_endpoint.py
@@ -112,16 +112,15 @@
         return {"message": f"Image {self.mask} uploaded successfully!"}
 
     def send_result(self):
-        time_sent = datetime.now(self.time_zone).strftime("yyyy-MM-dd'T'HH:mm:ss'Z'")
+        time_sent = datetime.now(self.time_zone).strftime("%Y-%m-%dT%H:%M:%SZ")
         print(str(self.flag_detected))
         header = {
-            'Content-Type': f'{self.image_type}',
-            'x-time-sent': time_sent,
-            'x-cctv-name': base64.b64encode(str(self.cctv_name).encode('utf-8')).decode('ascii'),
-            'x-cctv-latitude': str(self.cctv_latitude),
-            'x-cctv-longitude': str(self.cctv_longitude),
-            'x-area-percentage' : str(self.area_percent),
-            'x-flag_detected' : str(self.flag_detected),  #"True" or "False"
+            'X-Time-Sent': time_sent,
+            'X-CCTV-Name': base64.b64encode(str(self.cctv_name).encode('utf-8')).decode('ascii'),
+            'X-CCTV-Latitude': str(self.cctv_latitude),
+            'X-CCTV-Longitude': str(self.cctv_longitude),
+            'X-Area-Percentage' : str(self.area_percent),
+            'X-Flag-Detected' : str(self.flag_detected)  #"True" or "False"
         }
         session = requests.Session()
 
postprocess_draft.py
--- postprocess_draft.py
+++ postprocess_draft.py
@@ -132,7 +132,7 @@
         self.time_sent = request.headers.get('x-time-sent', '')
         self.cctv_latitude = request.headers.get('x-cctv-latitude', 'Not provided')
         self.cctv_longitude = request.headers.get('x-cctv-longitude', 'Not provided')
-        self.detected = request.headers.get('x-flag_detected')
+        self.detected = request.headers.get('x-flag-detected')
         if self.detected == "True":
             self.detected = True
         elif self.detected == "False":
Add a comment
List