HussainLatiff commited on
Commit
fb8e68c
Β·
verified Β·
1 Parent(s): 775e795

Update videoAnalysis.py

Browse files

better handle the error that occurs when searching a video uploaded for the first time

Files changed (1) hide show
  1. videoAnalysis.py +4 -4
videoAnalysis.py CHANGED
@@ -126,8 +126,8 @@ def videoAnalysis(sas_token, sas_url, search):
126
 
127
  if response_query.text == """{"error":{"code":"InvalidRequest","message":"Value for indexName is invalid."}}""":
128
  videoAnalysis(sas_token,sas_url, search)
129
-
130
- return response_query.text
131
 
132
  #Enter the sas token
133
  sas_token_1 = "sp=r&st=2024-02-09T12:33:24Z&se=2025-08-06T20:33:24Z&spr=https&sv=2022-11-02&sr=b&sig=V%2Fq56JjGcL60r0vt3oAPjzx%2FZMu5%2BJo%2BfjKkJF2ccgo%3D"
@@ -141,9 +141,9 @@ test_explosion = videoAnalysis(sas_token_1, sas_url_1, instance_1)
141
  print(test_explosion)
142
 
143
  #Enter the sas token
144
- sas_token_2 = "sp=r&st=2024-03-18T08:37:02Z&se=2027-04-22T16:37:02Z&spr=https&sv=2022-11-02&sr=b&sig=UqvmHzf1jzdD6njwO1S7YhD5a%2B7hZHrd3q3FaeV1WNg%3D"
145
  #the sas url
146
- sas_url_2= "https://store1video.blob.core.windows.net/haptic-vid/desert_vehicle.mp4?sp=r&st=2024-03-18T08:37:02Z&se=2027-04-22T16:37:02Z&spr=https&sv=2022-11-02&sr=b&sig=UqvmHzf1jzdD6njwO1S7YhD5a%2B7hZHrd3q3FaeV1WNg%3D"
147
  #query of what you are looking for
148
  instance_2 = "Vehicle racing"
149
 
 
126
 
127
  if response_query.text == """{"error":{"code":"InvalidRequest","message":"Value for indexName is invalid."}}""":
128
  videoAnalysis(sas_token,sas_url, search)
129
+ else:
130
+ return response_query.text
131
 
132
  #Enter the sas token
133
  sas_token_1 = "sp=r&st=2024-02-09T12:33:24Z&se=2025-08-06T20:33:24Z&spr=https&sv=2022-11-02&sr=b&sig=V%2Fq56JjGcL60r0vt3oAPjzx%2FZMu5%2BJo%2BfjKkJF2ccgo%3D"
 
141
  print(test_explosion)
142
 
143
  #Enter the sas token
144
+ sas_token_2 = "sp=r&st=2024-03-18T09:48:32Z&se=2026-07-02T17:48:32Z&spr=https&sv=2022-11-02&sr=b&sig=hLiFrDUtrutW9FWWRR7Z0Kbc4wkHs28YR9RXjVxw8uc%3D"
145
  #the sas url
146
+ sas_url_2= "https://store1video.blob.core.windows.net/haptic-vid/desert_vehicle_test.mp4?sp=r&st=2024-03-18T09:48:32Z&se=2026-07-02T17:48:32Z&spr=https&sv=2022-11-02&sr=b&sig=hLiFrDUtrutW9FWWRR7Z0Kbc4wkHs28YR9RXjVxw8uc%3D"
147
  #query of what you are looking for
148
  instance_2 = "Vehicle racing"
149