title: Get HTML content from htttps site in Python
body: <p>I want to get the HTML code from a site and write it into a file. It works fine with a http site but if there is a SSL link then I get a lot of errors. Any idea how to deal with it?</p>
  
  <pre><code>from __future__ import print_function
  import io
  import os
  import re
  import ssl
  from urllib.request import urlopen
  
      with io.open('words.txt', 'a',encoding="utf-8") as g:
          url = "https://www.something.some"
          html = urlopen(url).read()
          print(html, file = g)
  </code></pre>
  
  <p>Here the errors</p>
  
  <pre><code>Traceback (most recent call last):
    File "...\Desktop\mined.py", line 54, in &lt;module&gt;
      html = urlopen(url).read()
    File "...\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 163, in urlopen
      return opener.open(url, data, timeout)
    File "....\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 472, in open
      response = meth(req, response)
    File "...\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 582, in http_response
      'http', request, response, code, msg, hdrs)
    File "...\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 510, in error
      return self._call_chain(*args)
    File "...\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 444, in _call_chain
      result = func(*args)
    File "...\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 590, in http_error_default
      raise HTTPError(req.full_url, code, msg, hdrs, fp)
  urllib.error.HTTPError: HTTP Error 403: Forbidden
  </code></pre>