Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcel

Python Examples

Async
Certificates
ECC
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
JSON
Jwt
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
OAuth2
POP3
RSA Encryption
MIME
REST
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SSH Tunnel
SFTP
Stream
Tar Archive
XML
XMP
Zip

More Examples...
OpenSSL
Google APIs
Google Cloud Storage
Azure Cloud Storage
Amazon S3 (new)
Google Drive
Dropbox
Firebase
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
NTLM
QuickBooks
Spider
Digital Signatures

 

 

 

 

 

 

 

(Python) Simple FTP Download

Simple example to download a file from an FTP server.

Chilkat Python Downloads

Python Module for Windows, Linux, MAC OS X,
Solaris, FreeBSD, and ARM Embedded Linux

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()

ftp.put_Hostname("ftp.someFtpServer.com")
ftp.put_Username("myLogin")
ftp.put_Password("myPassword")

#  Connect and login to the FTP server.
success = ftp.Connect()
if (success != True):
    print(ftp.lastErrorText())
    sys.exit()

#  Change to the remote directory where the file is located.
#  This step is only necessary if the file is not in the root directory
#  for the FTP account.
success = ftp.ChangeRemoteDir("junk")
if (success != True):
    print(ftp.lastErrorText())
    sys.exit()

localFilename = "c:/temp/hamlet.xml"
remoteFilename = "hamlet.xml"

#  Download a file.
success = ftp.GetFile(remoteFilename,localFilename)
if (success != True):
    print(ftp.lastErrorText())
    sys.exit()

success = ftp.Disconnect()

print("File Downloaded!")

 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.