How to get the content of a remote file without a local temporary file with fabric

guettli picture guettli · Oct 11, 2013 · Viewed 8.5k times · Source

I want to get the content of a remote file with fabric, without creating a temporary file.

Answer

guettli picture guettli · Oct 12, 2013
from StringIO import StringIO
from fabric.api import get

fd = StringIO()
get(remote_path, fd)
content=fd.getvalue()