from config import config, init_conf
from bqueue import B_Queue
from config import config, init_conf
from bqueue import B_Queue
- req = urllib2.Request(url=src_url, headers=headers)
- f = urllib2.urlopen(req)
+ req = urllib.request.Request(url=src_url, headers=headers)
+ f = urllib.request.urlopen(req)
b.log_line("fetching %s" % src_url)
start = time.time()
good = False
while not good:
try:
headers = { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' }
b.log_line("fetching %s" % src_url)
start = time.time()
good = False
while not good:
try:
headers = { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' }
- req = urllib2.Request(url=src_url, headers=headers)
- f = urllib2.urlopen(req)
+ req = urllib.request.Request(url=src_url, headers=headers)
+ f = urllib.request.urlopen(req)
# fail in a way where cron job will retry
msg = "unable to fetch url %s, http code: %d" % (src_url, error.code)
b.log_line(msg)
# fail in a way where cron job will retry
msg = "unable to fetch url %s, http code: %d" % (src_url, error.code)
b.log_line(msg)
errno = 0
if isinstance(error.args[0], IOError):
errno = error.args[0].errno
errno = 0
if isinstance(error.args[0], IOError):
errno = error.args[0].errno