add cookie support to head.py, for e.g. nytimes urls
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user