0

I need to login ftps server in windows,am attaching the code which i tried to make a connection with ftps.

 from ftplib import FTP_TLS
 ftps = FTP_TLS('my host addres',990)
 ftps.login('username','password')          
 ftps.prot_p()          
 ftps.retrlines('LIST') 

when i execute this code am getting a socket error no 10060.i knew my ftp connection is implicit.I am very new to python.so please anyone help me out to solve this issue.

shilpa
  • 159
  • 1
  • 1
  • 12

1 Answers1

0

here is the answer for my question.in python there is one module called chilkat with that i can able to login into my implicit ftps server.

import sys
import chilkat

ftp = chilkat.CkFtp2()

#  Any string unlocks the component for the 1st 30-days.
success = ftp.UnlockComponent("Anything for 30-day trial")
if (success != True):
    print(ftp.lastErrorText())
    sys.exit()

#  If this example does not work, try using passive mode
#  by setting this to True.
ftp.put_Passive(False)
ftp.put_Hostname("ur host ip")
ftp.put_Username("usename")
ftp.put_Password("passowrd")
ftp.put_Port(990)

#  We don't want AUTH SSL:
ftp.put_AuthTls(False)

#  We want Implicit SSL:
ftp.put_Ssl(True)

#  Connect and login to the FTP server.
success = ftp.Connect()
if (success != True):
    print(ftp.lastErrorText())
    sys.exit()
else:
    #  LastErrorText contains information even when
    #  successful. This allows you to visually verify
    #  that the secure connection actually occurred.
    print(ftp.lastErrorText())

print("FTPS Channel Established!")

#  Do whatever you're doing to do ...
#  upload files, download files, etc...
localFilename = "c:/temp/hamlet.xml"
remoteFilename = "hamlet.xml"#the file name which u download from the ftps 
#  Download a file.
success = ftp.GetFile(remoteFilename,localFilename)
if (success != True):
    print(ftp.lastErrorText())

ftp.Disconnect()
shilpa
  • 159
  • 1
  • 1
  • 12