raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
<p>I am getting the following error while trying to parse a link using beautiful soup,looks like the authentication is failing....how to authenticate the link? </p>

<pre><code>from bs4 import BeautifulSoup
import argparse
import urllib
import urllib2
import getpass
import re

def update (searchurl):
    page = urllib2.urlopen(searchurl)
    soup = BeautifulSoup(page)
    #print(soup.textarea.string)
    print(soup.get_text())

def main ():
    #For logging
    print "test"
    parser = argparse.ArgumentParser(description='This is the update.py script created by test')
    parser.add_argument('-u','--url',action='store',dest='url',default=None,help='&lt;Required&gt; url link',required=True)
    results = parser.parse_args()# collect cmd line args
    url = results.url
    #print url
    update(url)
if __name__ == '__main__':
    main()
</code></pre>

<p>Following is the error while trying to open the link</p>

<pre><code>  Traceback (most recent call last):
      File "announce_update2.py", line 24, in &lt;module&gt;
        main()
      File "announce_update2.py", line 22, in main
        update(url)
      File "announce_update2.py", line 9, in update
        page = urllib2.urlopen(searchurl)
      File "C:\Python27\lib\urllib2.py", line 126, in urlopen
        return _opener.open(url, data, timeout)
      File "C:\Python27\lib\urllib2.py", line 406, in open
        response = meth(req, response)
      File "C:\Python27\lib\urllib2.py", line 519, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Python27\lib\urllib2.py", line 438, in error
        result = self._call_chain(*args)
      File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
        result = func(*args)
      File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
        return self.parent.open(new, timeout=req.timeout)
      File "C:\Python27\lib\urllib2.py", line 406, in open
        response = meth(req, response)
      File "C:\Python27\lib\urllib2.py", line 519, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Python27\lib\urllib2.py", line 444, in error
        return self._call_chain(*args)
      File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
        result = func(*args)
      File "C:\Python27\lib\urllib2.py", line 527, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
</code></pre>
