开发者

How can I access another server with Python?

开发者 https://www.devze.com 2023-01-06 06:00 出处:网络
I have two servers, and one updates with a DNSBL of 100k domains every 15 minutes. I want to process these domains through a Python script with information from Safebrowsing, Siteadvis开发者_开发百科o

I have two servers, and one updates with a DNSBL of 100k domains every 15 minutes. I want to process these domains through a Python script with information from Safebrowsing, Siteadvis开发者_开发百科or, and other services. Unfortunately, the server with the DNSBL is rather slow. Is there a way I can transfer the files over from the other server with SSH in Python?


If it's just files (and directories) you are transferring, why not just use rsync over ssh (in a bash script perhaps). A proven, mature method.

Or you could mount the remote filesystem (over ssh) into your own filesystem using sshfs (fuse) and then use something like pyrobocopy (implementing a basic version of rsync functionality in Python) to transfer the files.

If you don't need incremental copying, you could go the simple route: mount the remote filesystem using sshfs (link above) and then use shutil.copytree to copy the correct directory.

Or yet another option: implement it using the paramiko Python ssh module.


There is a module called pexpect which is pretty nice.

This allows you to ssh, telnet, etc. It also supports ftp which might be handy in transferring files.

0

精彩评论

暂无评论...
验证码 换一张
取 消