rebane2001 / matterport-dl

A downloader for matterport virtual tours
The Unlicense
291 stars 73 forks source link

Downloading model.. access url SSL error #71

Open mazshar opened 1 year ago

mazshar commented 1 year ago

Looks like there is an error when trying to resolve a URL which leads to a SSL certificate error. Although this matterport url is a public one so surprised to see an authentication issues.

Downloading model... access url: https://cdn-2.matterport.com/models/b5ee58d8061e46cb82e68782f8fc28a6/assets/~/{filename}?t=2-c471cf91932e6b88409056d14b5b46f8b86ffb7d-1659893127-1
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 975, in send
    self.connect()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1071, in _create
    self.do_handshake()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)

During handling of the above exception, another exception occurred:
JasonT77 commented 1 year ago

I am also experiencing the same issue. Including trying Ramadan's 2022-08-26 files.

Downloading base page... Downloading static assets... Downloading model info... Downloading images... Downloading graph model data... Patching graph_GetModelDetails.json URLs Downloading model ID: XXXXXXXXXX ... Traceback (most recent call last): File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output self.send(msg) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send self.connect() File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1454, in connect self.sock = self._context.wrap_socket(self.sock, File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create self.do_handshake() File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "........\matterport-dl.py", line 612, in initiateDownload(pageId) File "........\matterport-dl.py", line 477, in initiateDownload downloadPage(getPageId(url)) File "........\matterport-dl.py", line 469, in downloadPage downloadModel(pageid, accessurl) File "........\matterport-dl.py", line 270, in downloadModel downloadUUID(accessurl, modeldata["job"]["uuid"]) File "........\matterport-dl.py", line 48, in downloadUUID downloadFile(accessurl.format( File "........\matterport-dl.py", line 120, in downloadFile _filename, headers = urllib.request.urlretrieve( File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 241, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open response = self._open(req, data) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "C:\Users\Me\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>

mu-ramadan commented 1 year ago

@JasonT77 @mazshar

delete the script and redownload it again from here https://github.com/mu-ramadan/matterport-dl you must use --advanced-download option and server 127.0.0.1 8080 you can edit it on matterport-dl.py localServer = "http://127.0.0.1:8080" if you want to use different server IP address and port and redownload the virtual tour again to update graph_GetModelDetails with the new server and port

If your still facing the same issue you can you Email me the virtual tour URL? I'll try to check ..

JasonT77 commented 1 year ago

Thank you @mu-ramadan for confirming the tours I emailed you worked using your current script. It allowed me to research the problem further.

I discovered that the "Global Sign Atlas R3" Certificate being issued by Matterport for SSL, and being referred to by Requests expired in 2021.

The solution on Windows was to open the Certificate Manager - Run certmgr.msc and then deleting the R3 certificate under Intermediate Certification Authorities\Certificates

Then installing three new valid certificate from Let's Encrypt - Chain of Trust (Root and Intermediate Certificates)

Root CA Certificates ISRG Root X1 ISRG Root X2

Intermediate Certificate Let’s Encrypt R3

As soon as I installed these three certificates, the matterport-dl.py worked perfectly.

The expiration of the DST Root CA X3 is documented here.

Jason

chadcromwell commented 1 year ago

I ran into the same issue and it was solved by navigating to my Python directory and running the Install Certificates.command script.