简体   繁体   中英

How to connect to Droxbox via sftp Python?

I want to send/download file from Droxbox via Python. I've tried pysftp and paramiko , but the connect() call will hang. Below is my code.

import paramiko

# create a client
ssh = paramiko.SSHClient()
# can alos choose .WarningPolicy(), .RejectPolicy()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname="dropbox.com", username="my username", password="my pw")
# The call will hang there

sftp code

import pysftp as sftp
cnopts = sftp.CnOpts()
cnopts.hostkeys = None

'''If I don't set up cnopts, I'll get error - No hostkey for host dropbox.com found.
But I got a warning if I set up the above cnopts - 
CryptographyDeprecationWarning: Support for unsafe construction of 
public numbers from encoded data will be removed in a future 
version. Please use EllipticCurvePublicKey.from_encoded_point
self.ecdsa_curve.curve_class(), pointinfo
'''
s = sftp.Connection(host="dropbox.com",
                    username="xi@transcriptic.com",                             
                    password="Python@2018",
                    cnopts=cnopts)

Any suggestions would be greatly appreciated!

不幸的是,我不相信Dropbox支持SFTP。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM