def retrieve_url(paras): """Retrieve web pages from url """ logging.info('URL: {0}'.format(paras[0])) web = api.api_call2(*api.urlsplit(paras[0])).read(). \ decode('utf-8', errors='ignore') web = web.replace('\n', ' ') web = web.replace('\r', ' ') return ' '.join([paras[0], web])
def webpage_by_url(paras): """Retrieve web pages from url """ logging.info('URL: {0}'.format(paras[1])) try: web = api.api_call2(*api.urlsplit(paras[1])).read(). \ decode('utf-8', errors='ignore') if len(web) == 0: return {'list': list(),} return {'list': ({'place_id': paras[0], \ 'web': web},)} except: return {'list': list(),}
def webpage_by_url(paras): """Retrieve web pages from url """ logging.info('URL: {0}'.format(paras[1])) try: web = api.api_call2(*api.urlsplit(paras[1])).read(). \ decode('utf-8', errors='ignore') if len(web) == 0: return { 'list': list(), } return {'list': ({'place_id': paras[0], \ 'web': web},)} except: return { 'list': list(), }