简体   繁体   English

通过 python 连接到 SFTP 服务器

[英]connecting to an SFTP server via python

I've been stack for a few days now.我已经堆了几天了。 I'm wondering if anyone can help me with any suggestions on how to connect to the sFTP server below.我想知道是否有人可以帮助我就如何连接到下面的 sFTP 服务器提出任何建议。 The python code I've tried is as follows:我试过的 python 代码如下:

import pysftp

with pysftp.Connection(host ='https://api1.datasource.eex-group.com ', username = 'blablabla', password ='blablabla') as sftp:
    
    print ('Connected!')

When that didn't work, I tried this:当这不起作用时,我尝试了这个:

import requests

r = requests.get('https://api1.datasource.eex-group.com', auth=(' username', 'password')) 

Thanks in advance!提前致谢!

You can try this:你可以试试这个:

import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None   
with pysftp.Connection(host ='https://api1.datasource.eex-group.com ', username = 'blablabla', password ='blablabla', cnopts=cnopts) as sftp:

print ('Connected!')

Else here are a few solutions to this problem: "No hostkey for host ***** found" when connecting to SFTP server with pysftp using private key Verify host key with pysftp "No hostkey for... found" in pysftp code even though cnopts.hostkeys is set to None否则,这里有一些解决此问题的方法: 使用私钥通过 pysftp 连接到 SFTP 服务器时出现“找不到主机 ***** 的主机密钥” 使用 pysftp 验证主机密钥在 pysftp 代码中“没有找到...的主机密钥” 虽然 cnopts.hostkeys 设置为 None

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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