import urllib.request, urllib.parse, urllib.error
import lxml.html
from lxml.cssselect import CSSSelector
connection = urllib.request.urlopen('http://www.yourTargetURL/')
dom = lxml.html.fromstring(connection.read())
selAnchor = CSSSelector('a')
foundElements = selAnchor(dom)
print([e.get('href') for e in foundElements])
Python lxml/beautiful soup to find all links on a web page