<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Problem with urllib on https URLs"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=109241">109241</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Problem with urllib on https URLs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.3.4.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86 (IA32)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kiloran.public+bugzilla@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm having problems web scraping https sites using LibreOffice python. I have
Libreoffice 5.3.4.2 (x86) on Windows 7, and can demonstrate the problem with
this simple script:

import urllib.request
myUrl = '<a href="https://ask.libreoffice.org/en/questions/">https://ask.libreoffice.org/en/questions/</a>'
hdr = {'User-Agent': 'Mozilla/5.0'}
req = urllib.request.Request(url=myUrl, headers=hdr)
response = urllib.request.urlopen(req)

This fails immediately with "urlopen error unknown url type: https". It works
fine with an http url, but fails with any https url.

I tried the above in a LibreOffice Calc document with this embedded script and
it failed. It also failed when I tried running it in a terminal window from
C:\Program Files (x86)\LibreOffice 5\program\python-core-3.3.0\bin\python.exe

The script works fine with my standalone Python 3.3.2 running from a terminal
window.

I've also tried various LibreOffice Portable installations I have:

4.0.2.2: Works OK
5.3.1.2: Fails
5.3.2.2: Fails
I've tried uninstalling and reinstalling 5.3.4.2 more times than I can count
and cannot get it to work. Yet installing it on Windows 10 on the same PC using
a VM machine, it works fine.

I tried the Safe Mode in LibreOffice 5 and the script works fine. Went back to
normal mode and it failed again. Uninstalled LibreOffice 5.4.3.2 and then
deleted everything I could find relating to LibreOffice. Reinstalled 5.4.3.2
x86 and the behaviour is unchanged... works OK in Safe Mode and fails in normal
mode.

I did find a fix/workaround:

I renamed _ssl.pyd in C:\Program Files (x86)\LibreOffice
5\program\python-core-3.3.0\lib\ to _ssl.pyd(old).

I then copied _ssl.pyd from my standalone Python installation at C:\Program
Files (x86)\Python\DLLs\ and pasted it into the above folder.

LibreOffice now works OK, even though the original _ssl.pyd was just 48kB and
the replacement is 1162kB so they are very different.

Any idea why I am getting this problem on Windows 7?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>