How download a folder from pythonAnywhere in Matlab?
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Hornett
on 3 Sep 2024
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:
0 Comments
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!