def parse_url(url): output = {} crawler = LinkedinCrawler() try: items = crawler.start(url) # launching crawler except BadFormatError: return process_error(BadFormatError()) output["tags"] = [elem.get('label') for elem in items if 'label' in elem.keys()]# formatting output output["educations"] = [elem for elem in items if 'school' in elem.keys()] return json.dumps(output)
def parse_url(url): output = {} crawler = LinkedinCrawler() try: items = crawler.start(url) # launching crawler except BadFormatError: return process_error(BadFormatError()) output["tags"] = [ elem.get('label') for elem in items if 'label' in elem.keys() ] # formatting output output["educations"] = [elem for elem in items if 'school' in elem.keys()] return json.dumps(output)
def parse_url(url): if get_status_code(url)==404: # page is not found return error(PageNotFoundError()) output = {} crawler = LinkedinCrawler() try: items = crawler.start(url) # launching crawler except BadFormatError: return error(BadFormatError()) output["tags"]= [elem.get('label') for elem in items if 'label' in elem.keys()]# formatting output output["educations"] = [elem for elem in items if 'school' in elem.keys()] return json.dumps(output)