I'm starting writing in Python and is tasked with writing a simple tool that opens a web-page, collects all the URLs (both complete like http://mail.com and relative ones like /mail/inbox) and returns a list of them prefixed with the domain name. The code is below.Could someone take a look and advise on what could've been better in terms of the code style, readability, general coding principles and code quality?Appreciate your help!import sys, requestsfrom bs4 import BeautifulSoupfrom urllib.parse import urlparsedef main(argv):    ''' Main '''    links = []    try:        if len(argv) != 3:            raise IndexError(Not enough arguments.)        url = argv[2].rstrip('/')        scheme = urlparse(url).scheme        if argv[1].upper() in ['GET', 'POST', 'OPTIONS', 'PUT', 'DELETE']:            method = argv[1]        else:            raise ValueError(Method %s is not supported. % argv[1])        r = requests.request(method, url, verify=False) # get the response        url = r.url.rstrip('/') # if there was a redirect - acquire the URL from the response        print('[+] Retrieving '+url)        raw_html = r.content        soup = BeautifulSoup(raw_html, html.parser)        # neat print headers        print([+] Received the response HTTP %d % r.status_code)        for header in r.headers:            print(header + ':', r.headers[header])        # gathering a list of hrefs and srcs        for script in soup.find_all('script'):            if not script == None:                links.append(script.get('src'))        for anchor in soup.find_all('a'):            if not anchor == None:                links.append(anchor.get('href'))        for link in soup.find_all('link'):            if not link == None:                links.append(link.get('href'))        for form in soup.find_all('form'):            if not form == None:                links.append(form.get('action'))        links = list(filter(None, links)) # removing None src's        links = [link for link in links if                 not link[0] == '#' and                 not urlparse(link).scheme in ['mailto', 'skype'] and                 not link == '/'] # removing bookmarks, emails and skype and '/'        links = [scheme + '://' + link[2:] if link[0:2] == '//' else                 link if urlparse(link).scheme in ['http', 'https'] else                 url + link if link[0] == '/' else                 url+'/'+link for link in links] # appending URL value    except Exception as e:        print([-] Something went wrong: %s % e)    except KeyboardInterrupt as e:        print([x] Exiting by user command)    print(\n[+] %d Links extracted: % len(links))    for link in links:        print(link)    return linksif __name__ == __main__:    print('[*] Starting the main module')    main(sys.argv)
A tool to extract all links from a web-page in Python
python;web scraping;beautifulsoup