I have to use a try and except block with the following code, as I am trying to get a model class object but in case if database is empty so for that I need to use try and except.
if(txStatus=='SUCCESS'):
    order=Order.objects.get(id=id)    #NEED TRY ACCEPT BLOCK FOR THIS
    URL = payment_collection_webhook_url 
    request_data ={}          
    json_data = json.dumps(request_data)
    requests.post(url = URL, data = json_data)
    return Response(status=status.HTTP_200_OK)
 
     
     
     
    