How download a folder from pythonAnywhere in Matlab?

3 visualizaciones (últimos 30 días)
Fabiola Gangi
Fabiola Gangi el 7 de Jun. de 2022
Respondida: Hornett el 3 de Sept. de 2024
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.

Respuestas (1)

Hornett
Hornett el 3 de Sept. de 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:

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by