From 18a24a81174d84941e74ddbf5864fb1b8d2948bc Mon Sep 17 00:00:00 2001 From: David Moore Date: Sat, 5 Mar 2011 15:02:22 -0600 Subject: [PATCH] add cookie support to head.py, for e.g. nytimes urls --- modules/head.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/head.py b/modules/head.py index 1008628..5231edb 100755 --- a/modules/head.py +++ b/modules/head.py @@ -7,11 +7,15 @@ Licensed under the Eiffel Forum License 2. http://inamidst.com/phenny/ """ -import re, urllib, urllib2, httplib, urlparse, time +import re, urllib, urllib2, httplib, urlparse, time, cookielib from htmlentitydefs import name2codepoint import web from tools import deprecated +cj = cookielib.LWPCookieJar() +opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) +urllib2.install_opener(opener) + def head(phenny, input): """Provide HTTP HEAD information.""" uri = input.group(2)