parent
e6811138fd
commit
8a4d68d72c
|
@ -33,7 +33,7 @@ MIMETYPE = {
|
|||
DEFAULT_UA = 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0'
|
||||
|
||||
|
||||
def custom_handler(accept=None, strict=False, delay=None, encoding=None, basic=False):
|
||||
def custom_handler(accept=None, strict=False, delay=None, encoding=None):
|
||||
handlers = []
|
||||
|
||||
# as per urllib2 source code, these Handelers are added first
|
||||
|
@ -51,9 +51,7 @@ def custom_handler(accept=None, strict=False, delay=None, encoding=None, basic=F
|
|||
handlers.append(HTTPEquivHandler())
|
||||
handlers.append(HTTPRefreshHandler())
|
||||
handlers.append(UAHandler(DEFAULT_UA))
|
||||
|
||||
if not basic:
|
||||
handlers.append(AutoRefererHandler())
|
||||
handlers.append(AutoRefererHandler())
|
||||
|
||||
handlers.append(EncodingFixHandler(encoding))
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ def FeedFetch(url, options):
|
|||
|
||||
try:
|
||||
con = crawler.custom_handler(accept='xml', strict=True, delay=delay,
|
||||
encoding=options.encoding, basic=not options.items) \
|
||||
encoding=options.encoding) \
|
||||
.open(url, timeout=TIMEOUT * 2)
|
||||
xml = con.read()
|
||||
|
||||
|
|
Loading…
Reference in New Issue