I would like to FTP the files that are generated by my qapp to a local server.
Best answer by pradeep.gaddameedi
View originalI would like to FTP the files that are generated by my qapp to a local server.
Best answer by pradeep.gaddameedi
View originalHi Rakesh, I think you want to upload an output csv file from Qapp to an FTP server.
There is no straight forward approach in Qapp for this. You can follow below approach to save Qapp output in JSON format, CSV format or any other text format.
Sample Code in Qapp:
from ftplib import FTP
import io
csvString = """
Col1,Col2\n
Data11,Data12\n
Data21,Data22
"""
byteString = bytes(csvString, 'utf-8')
fileObj = io.BytesIO(byteString)
ftp = FTP('10.10.0.1') #FTP server Name or IP address
ftp.login(user='ftpuser', passwd = 'password') #FTP server login credentials
ftp.storbinary("STOR TestFile.csv",fileObj) #File Object will be stored as a file.
ftp.quit()
Note: FTP ports should be opened for source IP of NetBrain worker server destined to FTP server.
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.