基于Asyncssh和Asyncio库实现SCP传输文件
为了提升SCP并发传输速度引入异步操作
import asyncssh
import asyncio
import nest_asyncio
#引入nest_asyncio库apply()方法是为了能在jupyter上运行
nest_asyncio.apply()
async def scp_example():
async with asyncssh.connect('host', username='username', password='pwd') as conn:
await asyncssh.scp('/from_file', (conn, '/to_path'))
## Run the async function
asyncio.run(scp_example())

浙公网安备 33010602011771号