add cookie support to head.py, for e.g. nytimes urls

This commit is contained in:
David Moore
2011-03-05 15:02:22 -06:00
parent ecb8af1bbe
commit 18a24a8117

View File

@@ -7,11 +7,15 @@ Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/ http://inamidst.com/phenny/
""" """
import re, urllib, urllib2, httplib, urlparse, time import re, urllib, urllib2, httplib, urlparse, time, cookielib
from htmlentitydefs import name2codepoint from htmlentitydefs import name2codepoint
import web import web
from tools import deprecated from tools import deprecated
cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
def head(phenny, input): def head(phenny, input):
"""Provide HTTP HEAD information.""" """Provide HTTP HEAD information."""
uri = input.group(2) uri = input.group(2)