@gen.coroutine
def get_links_from_url(url):
 try:
  response = (yield httpclient.AsyncHTTPClient().fetch(url))
  print ('fetched %s' % url)
  html = (response.body if isinstance(response.body, str) else response.body.decode())
  urls = [urljoin(url, remove_fragment(new_url)) for new_url in get_links(html)]
 except Exception as e:
  print ('Exception: %s %s' % (e, url))
  raise gen.Return([])
 raise gen.Return(urls)

@ gen . coroutine def get_links_from_url ( url ) : try : response = ( yield httpclient . AsyncHTTPClient ( ) . fetch ( url ) ) print ( 'fetched %s' % url ) html = ( response . body if isinstance ( response . body , str ) else response . body . decode ( ) ) urls = [ urljoin ( url , remove_fragment ( new_url ) ) for new_url in get_links ( html ) ] except Exception as e : print ( 'Exception: %s %s' % ( e , url ) ) raise gen . Return ( [ ] ) raise gen . Return ( urls )
download the page at url and parse it for links .