vendredi 18 septembre 2020

Python Else not passing when IF fail to get json reponse

        global JsonResponse      
    JsonResponse = response.json()['error']     
    if response.json()['error']:        
     print ("\n" + "Notice =" , (JsonResponse)) 
     
    else:
     sys.exit(Y+ "Account Created Successfully")    

i can't pass with else result 'IF' always giving me KeyError: 'error'

Aucun commentaire:

Enregistrer un commentaire