rishi1985 commited on
Commit
4848391
1 Parent(s): ea82286

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -404,6 +404,17 @@ def do_ML2(id:str,text:str,host:str, trycount:int):
404
  time.sleep(0.2)
405
  # currtime= time.time()
406
  # if(currtime>starttime+18.5):
 
 
 
 
 
 
 
 
 
 
 
407
 
408
  # return "Request Could not be proceed"
409
  try:
@@ -423,7 +434,7 @@ def do_ML2(id:str,text:str,host:str, trycount:int):
423
  except:
424
  print("Error")
425
  driver.delete_all_cookies()
426
- if trycount>4:
427
 
428
  return "Request Could not be proceed"
429
  driver.quit()
 
404
  time.sleep(0.2)
405
  # currtime= time.time()
406
  # if(currtime>starttime+18.5):
407
+ try:
408
+ messages = driver.find_elements(By.CLASS_NAME,"messageContain")
409
+ x= messages[len(messages)-2]
410
+ # Extract the text from the 'p' element within the 'div' with class 'messageContain'
411
+ message_text = x.find_element(By.TAG_NAME,"p").text
412
+ if message_text=='The request could not be processed':
413
+ return "The request could not be processed"
414
+ except Exception as e:
415
+ print(e)
416
+ pass
417
+
418
 
419
  # return "Request Could not be proceed"
420
  try:
 
434
  except:
435
  print("Error")
436
  driver.delete_all_cookies()
437
+ if trycount>2:
438
 
439
  return "Request Could not be proceed"
440
  driver.quit()