On Fri, 17 Jun 2011 20:53:39 +0300, gervaz <[email protected]> wrote:
I decided to implement this solution:
class HeadRequest(urllib.request.Request):
def get_method(self):
return "HEAD"
Now I download the url using:
r = HeadRequest(url, None, self.headers)
c = urllib.request.urlopen(r)
but I don't know how to retrieve the request status (e.g. 200) as in
the previous examples with a different implementation...
Use c.getcode() to get the response code. When you're testing interactively, you might
find printing the headers with "print c.headers" quite handy.
Don't forget to close the response (c.close()) when your script exits its
experimental state.
--
http://mail.python.org/mailman/listinfo/python-list