Making HEAD/PUT/DELETE requests with urllib2?

Phillip B Oldham phillip.oldham at
Sat Jun 14 01:40:05 CEST 2008

In my attempt to learn python in a weekend, I've fallen foul at line
10 of my second scripting attempt. Basically I'm writing a simple
spider, but currently I'm unable to find any documentation on making
HEAD requests using the urllib2 library to test whether a file exists
on a remote webserver.

I've checked the docs on urllib2 from, and unless I'm
missing something there doesn't seem to be a way to do *any* request
other than a GET and POST.

Surely this can't be correct? If so, we're all going to have a hell of
a time creating RESTful web apps.

Any help on the matter would be greatly appreciated.

More information about the Python-list mailing list