Python Forum
Uploading files to NAS from Raspberry PI using python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Uploading files to NAS from Raspberry PI using python (/thread-29514.html)



Uploading files to NAS from Raspberry PI using python - zazas321 - Sep-07-2020

Hello. We have NAS drive connected to our network.IT administrator allocated me 4GB of space for testing and I have been given ID,password, and the IP address to access the NAS. By typing given IP address on the browser, I can access my NAS and upload files there.

[Image: 0ygr3Zr]


However, I need to be able to upload images to NAS drive from python script. I have been looking at SMBConnection library and trying the following code:
from smb.SMBConnection import SMBConnection

conn = SMBConnection('given_ID','given_pass','????','????')
conn.connect('192.168.50.230')

results = conn.listPath('File Station','Raspberry_Pi')

for x in results:
   print(x.filename)
Note that for 3rd and 4th argument I have put ???? since I cannot figure out what do I need to pass there. Unfortunately, reading documentation does make it more clear:
https://pysmb.readthedocs.io/en/latest/api/smb_SMBConnection.html


I think that could be an issue since I am not passing these two arguments correctly. Could someone give me a hint and let me know what am I supposed to pass there?

Whatever code I put below conn.connect line, The output is the same:
[Image: h1Byq67]