How download a folder from pythonAnywhere in Matlab?

3 次查看(过去 30 天)
Hi,
I have to download a *.csv in a folder that a python code generate everyday in pythonAnywhere.
I just check to use webread but i don't know how put the username and password or how to aim to the folder/file I want.
Please help me.

回答(1 个)

Hornett
Hornett 2024-9-3
I undertand that you are trying to download a folder/file from your “pythonAnywhere” server using MATLAB
To utilize a username and password in the `webread` function, you can pass the credentials by creating a `Credentials` object. Additionally, to specify the directory of the file, you can provide the file address as a parameter to the `webread` function.
Here is a sample code demonstrating the same:
% Example username and password
username = 'myUser';
password = 'myPassword';
% Manually set Authorization header field in weboptions
options = weboptions('HeaderFields',{'Authorization',...
['Basic ' matlab.net.base64encode([username ':' password])]});
% Make a request using these options
url = "https://yoururlhere"; % Replace the destination file or directory address here
webread(url, options)
You can also refer the below links for more details about webread function:

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by