Python Forum
Is the paramiko's API threading safe?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is the paramiko's API threading safe?
#1
I want to download files using paramiko with multithreading.
But I am not sure if the paramiko's API is threading safe.
If the API is threading safe, then I can write codes as following: (python 3.6)

from paramiko import SSHClient, AutoAddPolicy
from concurrent.futures import ThreadPoolExecutor
from typing import List

def dowload(files: List[str]) -> None:
    client = SSHClient()
    client.set_missing_host_key_policy(AutoAddPolicy()) 
    client.connect(username=.., ..)
    sftp = client.open_sftp()
    with ThreadPoolExecutor(10) as pool:
        pool.map(lambda fn: sftp.get(fn, fn), files)
Is the code right? And if there any document mentioned about the threading safe?Think
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  safe output in a file for all switches in a network henry1077 0 2,737 Jul-26-2018, 01:05 PM
Last Post: henry1077

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020