0👍
✅
You should be able to tell that you recieved a 404, because the response code was not 200. That is:
import urllib
resp = urllib.urlopen('http://example.com/')
if resp.getcode() == 200:
rejoice()
if resp.getcode() == 404:
sulk()
2👍
Find the first non-whitespace character. If it’s “<” then you have HTML.
Also, check the content type header and HTTP status code.
- [Answered ]-Data not sent using jquery to a Django view
- [Answered ]-Django: How to use model properties within custom methods in a serializer?
- [Answered ]-BooleanField custom validator not working
- [Answered ]-Django 1.8 PUT and DELETE method simple implementation
Source:stackexchange.com