download data from https

I would like to download data with webread from an https witha formed complex query (without using the basic query options in webread, websave as they would not work).
However I am getting a "Rorbidden" answer and error that does not explain much.
Any ideas?

1 件のコメント

Rik
Rik 2021 年 6 月 21 日
Have you checked if the specific website allows non-human access?
Also, how do you expect us to give you a solution if you only tell us you're getting an 'access forbidden' error?

サインインしてコメントする。

回答 (1 件)

Amrtanshu Raj
Amrtanshu Raj 2021 年 6 月 25 日

0 投票

Hi,
As mentioned in the documentation. The Forbidden error is shown when Client does not have the correct credentials to make a request.
Hope this helps.

6 件のコメント

Rik
Rik 2021 年 6 月 25 日
This error may also happen if non-human requests are blocked.
Stefano Pietri
Stefano Pietri 2021 年 6 月 25 日
This is one of the websites I am trying to open.
I can open it from my python script without credentials so I don't understand why it would not work in Matlab.
Rik
Rik 2021 年 6 月 26 日
What exact code did you try?
Stefano Pietri
Stefano Pietri 2021 年 6 月 26 日
>> mchp = webread("https://query1.finance.yahoo.com/v7/finance/download/MCHP?period=11624665600&period2=1624665600&interval=1d&events=history&includeAdjustedClose=true")
Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 373)
The server returned the status 403 with message "Forbidden" in response to the request to URL
https://query1.finance.yahoo.com/v7/finance/download/MCHP?period1=1624665600&period2=1624665600&interval=1d&events=history&includeAdjustedClose=true.
Error in readContentFromWebService (line 46)
byteArray = copyContentToByteArray(connection);
Error in webread (line 125)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
Stefano Pietri
Stefano Pietri 2021 年 6 月 26 日
however I can use the following python code and it works:
response = ulib.request.urlopen("https://...")
data = response.read()
Image Analyst
Image Analyst 2021 年 6 月 26 日
You can use Python from MATLAB - there is a webinar on that.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2021a

質問済み:

2021 年 6 月 21 日

コメント済み:

2021 年 6 月 26 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by