matterport-dl icon indicating copy to clipboard operation
matterport-dl copied to clipboard

HTTPError: 401 Client Error: Unauthorized for url

Open HenrysCat opened this issue 1 year ago • 5 comments

Using this fork https://github.com/mu-ramadan/matterport-dl (issues are disabled) I get the error below. Anyone else?

  File "C:\Users\name\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://cdn-2.matterport.com/models/514367ca87594b23a23d71473f312ba8/assets/~/78c970395434469aa613daa6f79b4b30_50k.dam?t=2-745fb43caf5ea7fffd5d9da044d69107493d36ce-1706268502-1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\matterport-dl-main\matterport-dl.py", line 690, in <module>
    initiateDownload(pageId)
  File "C:\matterport-dl-main\matterport-dl.py", line 555, in initiateDownload
    downloadPage(getPageId(url))
  File "C:\matterport-dl-main\matterport-dl.py", line 547, in downloadPage
    downloadModel(pageid, accessurl)
  File "C:\matterport-dl-main\matterport-dl.py", line 289, in downloadModel
    downloadUUID(accessurl, modeldata["job"]["uuid"])
  File "C:\matterport-dl-main\matterport-dl.py", line 48, in downloadUUID
    downloadFile(accessurl.format(
  File "C:\matterport-dl-main\matterport-dl.py", line 154, in downloadFile
    raise Exception
Exception

HenrysCat avatar Jan 25 '24 12:01 HenrysCat

Hi! Same error here. I'm having an Unauthorized error that worried me about if Matterport have changed something to avoid we can use the @mu-ramadan code:

Downloading base page... Doing advanced download of dollhouse/floorplan data... Downloading static assets... JS FILE EXTRACTED, 217.js JS FILE EXTRACTED, 231.js JS FILE EXTRACTED, 27.js JS FILE EXTRACTED, 324.js JS FILE EXTRACTED, 325.js JS FILE EXTRACTED, 327.js JS FILE EXTRACTED, 378.js JS FILE EXTRACTED, 401.js JS FILE EXTRACTED, 425.js JS FILE EXTRACTED, 477.js JS FILE EXTRACTED, 625.js JS FILE EXTRACTED, 648.js JS FILE EXTRACTED, 653.js JS FILE EXTRACTED, 672.js JS FILE EXTRACTED, 679.js JS FILE EXTRACTED, 746.js JS FILE EXTRACTED, 782.js JS FILE EXTRACTED, 858.js JS FILE EXTRACTED, 948.js JS FILE EXTRACTED, 958.js JS FILE EXTRACTED, 973.js Downloading model info... Downloading images... Downloading graph model data... Patching graph_GetModelDetails.json URLs Downloading model ID: 6XuZphEUkv9 ... Traceback (most recent call last): File "/Users/macbookpro/matterport-dl.py", line 129, in downloadFile response.raise_for_status() # Raise an exception if the response has an error status code ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://cdn-2.matterport.com/models/447dccdb5f454569860d0314790c62f8/assets/~/929b8272d6fc433ba1fe37e5eb83c5ad_50k.dam?t=2-dd2eb14abc0ff2889ecb1162169301f28ba1898a-1709219928-1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/macbookpro/matterport-dl.py", line 690, in initiateDownload(pageId) File "/Users/macbookpro/matterport-dl.py", line 555, in initiateDownload downloadPage(getPageId(url)) File "/Users/macbookpro/matterport-dl.py", line 547, in downloadPage downloadModel(pageid, accessurl) File "/Users/macbookpro/matterport-dl.py", line 289, in downloadModel downloadUUID(accessurl, modeldata["job"]["uuid"]) File "/Users/macbookpro/matterport-dl.py", line 48, in downloadUUID downloadFile(accessurl.format( File "/Users/macbookpro/matterport-dl.py", line 154, in downloadFile raise Exception Exception

Please, could someone help me with this and test if this code still working? Thanks in advance!

SportsApps avatar Feb 28 '24 18:02 SportsApps

I too am seeing this 401 error while using the fork:

Downloading base page... Downloading static assets... JS FILE EXTRACTED, 217.js JS FILE EXTRACTED, 231.js JS FILE EXTRACTED, 27.js JS FILE EXTRACTED, 324.js JS FILE EXTRACTED, 325.js JS FILE EXTRACTED, 327.js JS FILE EXTRACTED, 378.js JS FILE EXTRACTED, 401.js JS FILE EXTRACTED, 455.js JS FILE EXTRACTED, 477.js JS FILE EXTRACTED, 589.js JS FILE EXTRACTED, 613.js JS FILE EXTRACTED, 625.js JS FILE EXTRACTED, 648.js JS FILE EXTRACTED, 672.js JS FILE EXTRACTED, 679.js JS FILE EXTRACTED, 746.js JS FILE EXTRACTED, 782.js JS FILE EXTRACTED, 858.js JS FILE EXTRACTED, 884.js JS FILE EXTRACTED, 958.js JS FILE EXTRACTED, 973.js Downloading model info... Downloading images... Downloading graph model data... Patching graph_GetModelDetails.json URLs Downloading model ID: 4W4ag4FNrvk ... Traceback (most recent call last): File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 129, in downloadFile response.raise_for_status() # Raise an exception if the response has an error status code ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jason\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://cdn-2.matterport.com/models/7a64c8084ab34d6f91e77d2ec2004dca/assets/~/14f7fcdc6c9e4318bb118379bb4a47bf_50k.dam?t=2-f02959028896cbe5b81abe4841fca268a577b822-1712829222-1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 689, in initiateDownload(pageId) File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 554, in initiateDownload downloadPage(getPageId(url)) File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 546, in downloadPage downloadModel(pageid, accessurl) File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 288, in downloadModel downloadUUID(accessurl, modeldata["job"]["uuid"]) File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 48, in downloadUUID downloadFile(accessurl.format( File "C:\Users\jason\Desktop\matterport-dl\matterport-dl.py", line 154, in downloadFile raise Exception Exception

cizzop avatar Apr 11 '24 00:04 cizzop

I was able to work around this (on mu-ramadan's fork) by installing httpx with http2 support and changing the original request calls to compatible httpx calls.

Also edited the beginning of downloadUUID() to

#downloadFile(accessurl.format(

#    filename=f'{uuid}_50k.dam'), f'{uuid}_50k.dam')

shutil.copy(f'..{os.path.sep}{uuid}_50k.dam', f'{uuid}_50k.dam')

as the dam file was already downloaded and the second download using ~/ in the path fails.

The hosting isn't working though, just get a model not available error.

ServError avatar Apr 21 '24 06:04 ServError

changing the original request calls to compatible httpx calls.

Can you provide an example of what you changed? I'm not really a coder so an example would really help to get this working.

edit: any chance you could just share your modified matterport-dl.py file?

@ServError

cizzop avatar Apr 25 '24 05:04 cizzop

I was able to work around this (on mu-ramadan's fork) by installing httpx with http2 support and changing the original request calls to compatible httpx calls.

Also edited the beginning of downloadUUID() to

#downloadFile(accessurl.format(

#    filename=f'{uuid}_50k.dam'), f'{uuid}_50k.dam')

shutil.copy(f'..{os.path.sep}{uuid}_50k.dam', f'{uuid}_50k.dam')

as the dam file was already downloaded and the second download using ~/ in the path fails.

The hosting isn't working though, just get a model not available error.

Please, some helpful would be amazing..

SportsApps avatar Apr 25 '24 11:04 SportsApps

@ServError Still having

Traceback (most recent call last):
  File "/Users/jetienne/dev/ultra/hell-ultra/matterport-dl/matterport-dl.py", line 690, in <module>
    initiateDownload(pageId)
  File "/Users/jetienne/dev/ultra/hell-ultra/matterport-dl/matterport-dl.py", line 555, in initiateDownload
    downloadPage(getPageId(url))
  File "/Users/jetienne/dev/ultra/hell-ultra/matterport-dl/matterport-dl.py", line 547, in downloadPage
    downloadModel(pageid, accessurl)
  File "/Users/jetienne/dev/ultra/hell-ultra/matterport-dl/matterport-dl.py", line 289, in downloadModel
    downloadUUID(accessurl, modeldata["job"]["uuid"])
  File "/Users/jetienne/dev/ultra/hell-ultra/matterport-dl/matterport-dl.py", line 51, in downloadUUID
    shutil.copy(f'..{os.path.sep}{uuid}_50k.dam', f'{uuid}_50k.dam')
  File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/shutil.py", line 435, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/opt/homebrew/Cellar/[email protected]/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
after install

jetienne avatar May 22 '24 18:05 jetienne

@jetienne

I was able to get this working on the mu-ramadan branch by merging PR 2 and 3 into main.

See here:

https://github.com/mu-ramadan/matterport-dl/pull/3#issuecomment-2121812742

cizzop avatar May 23 '24 03:05 cizzop

@jetienne Could you try directly with https://github.com/ni0ki/matterport-dl (and --advanced-download option) while we're waiting for the above to be merged? Let me know. Thx

ni0ki avatar May 24 '24 07:05 ni0ki

I did end up trying those two PRs on top of the fork, along with some additions to bring in firefox cookies (so I could download my own private / free account matterport tours) and can confirm that both the download and hosting work.

ServError avatar May 26 '24 20:05 ServError

I did end up trying those two PRs on top of the fork, along with some additions to bring in firefox cookies (so I could download my own private / free account matterport tours) and can confirm that both the download and hosting work.

Please!!! Could you share the merged matterport-dl.py? I tried modify the lines of code but I received another error...

SportsApps avatar May 26 '24 21:05 SportsApps

@SportsApps

Here is what worked for me.

cizzop avatar May 28 '24 04:05 cizzop

This should be fixed now, please test again on master and let us know if not.

mitchcapper avatar Aug 04 '24 06:08 mitchcapper