File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -715,6 +715,22 @@ ftp.retrlines("LIST") # 列出当前目录的内容
715715ftp.quit()
716716</source>
717717
718+ <h4>pysftp</h4>
719+
720+ Home:[https://bitbucket.org/dundeemt/pysftp]
721+
722+ 封装 [https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol SFTP ] 协议,依赖于 ssh.py
723+
724+ 代码示例——简单的上传/下载
725+ <source lang="python">
726+ import pysftp
727+
728+ with pysftp.Connection("hostxxx", username="userxxx", password="xxxxxx") as sftp :
729+ with sftp.cd("public") # 服务端当前目录切换到 public
730+ sftp.put("/my/local/filename") # 上传某个本地文件到服务端的 public 目录
731+ sftp.get_r("myfiles", "/local") # 递归复制某个服务端的目录到本地
732+ </source>
733+
718734=== 5.3.4 电子邮件 ===
719735
720736<h4>smtplib</h4>
@@ -772,8 +788,8 @@ tn.read_until("login: ")
772788tn.write(user + "\n")
773789
774790if password :
775- tn.read_until("Password: ")
776- tn.write(password + "\n")
791+ tn.read_until("Password: ")
792+ tn.write(password + "\n")
777793
778794tn.write("ls\n")
779795tn.write("exit\n")
You can’t perform that action at this time.
0 commit comments