def _get_server_status_code(url):
 (host, path, params, query) = urlparse.urlparse(url)[1:5]
 try:
  conn = httplib.HTTPConnection(host)
  conn.request('HEAD', ((path + '?') + query))
  return conn.getresponse().status
 except StandardError:
  return None

def _get_server_status_code ( url ) : ( host , path , params , query ) = urlparse . urlparse ( url ) [ 1 : 5 ] try : conn = httplib . HTTPConnection ( host ) conn . request ( 'HEAD' , ( ( path + '?' ) + query ) ) return conn . getresponse ( ) . status except StandardError : return None
download just the header of a url and return the servers status code .