Connect to mrn archive host via Python

Hi team, I'm trying to use below codes to connect to our archive.news.refinitiv.com host but encountered the error below.

pysftp.Connection(host='archive.news.refinitiv.com', username='GE-xxxxxxx', password='xxxxxx')

ERROR: No hostkey for host archive.news.refinitiv.com found.

May I know what's the reason for that and how should I correct the code to connect? It seems I don't have such thing called "hostkey". Thanks team.

Best Answer

  • @Julian.Bai

    Thank you for reaching out to us.

    I found this answer on StackOverflow.

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

    pysftp.Connection(host='archive.news.refinitiv.com', username='GE-xxxxxxx', password='xxxxxx',cnopts=cnopts)

    Instead of setting the hostkeys to None, you can use another solution mentioned on that discussion.

Answers