title: fetch html resources using urllib with authentication
body: <p>There is one public  html webpage where some content is available. With <code>urllib</code> I am able to fetch contents. But there another version where if I am logged in as user, additional content is available. in order to fetch   <code>logged-in page</code> I use solution provided on portal  and also  <a href="https://gist.github.com/kaito834/36e693a3a54057666d28" rel="nofollow noreferrer">urllib basic auth</a></p>
  <pre><code>import urllib.request
  passman = urllib.request.HTTPPasswordMgrWithDefaultRealm()
  passman.add_password(None, url, username, password)
  authhandler = urllib.request.HTTPBasicAuthHandler(passman)
  opener = urllib.request.build_opener(authhandler)
  urllib.request.install_opener(opener)
  res = urllib.request.urlopen(url)
  res_body = res.read()
  res_body.decode('utf-8')
  </code></pre>
  <p>When I check contents I do not see what is additionally available for <code>logged-in user</code> . I would like to know how to correct this .  I am using python 3.</p>
  <p>Thanks</p>