http-status-codes

What is the http status code when Api raises ValueError?

What is the http status code when Api raises ValueError? Question: I am raising Value Error in my API because the input parameter of a particular function is not valid like below Password doesn’t match User doesn’t exist in db or the value is negative Client provided valid argument as per the API norms so …

Total answers: 4

List of Django exceptions and response codes

List of Django exceptions and response codes Question: Certain django exceptions have associated status codes. For example: The SuspiciousOperation exception returns a 400 if it is raised. The PermissionDenied exception returns a 403 if it is raised. The Http404 exception returns a 404 status if it is raised. Where can I find a comprehensive list …

Total answers: 2

Http Redirection code 3XX in python requests

Http Redirection code 3XX in python requests Question: I am trying to capture http status code 3XX/302 for a redirection url. But I cannot get it because it gives 200 status code. Here is the code: import requests r = requests.get(‘http://goo.gl/NZek5’) print r.status_code I suppose this should issue either 301 or 302 because it redirects …

Total answers: 4

Python Request Post with param data

Python Request Post with param data Question: This is the raw request for an API call: POST http://192.168.3.45:8080/api/v2/event/log?sessionKey=b299d17b896417a7b18f46544d40adb734240cc2&format=json HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: application/json Content-Length: 86 Host: 192.168.3.45:8080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) {"eventType":"AAS_PORTAL_START","data":{"uid":"hfe3hf45huf33545","aid":"1","vid":"1"}} This request returns a success (2xx) response. Now I am trying to post this request using requests: import requests headers = …

Total answers: 3