How download a folder from pythonAnywhere in Matlab?

3 vues (au cours des 30 derniers jours)
Fabiola Gangi
Fabiola Gangi le 7 Juin 2022
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.

Réponses (1)

Hornett
Hornett le 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:

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by