Ответ 1
from StringIO import StringIO
from fabric.api import get
fd = StringIO()
get(remote_path, fd)
content=fd.getvalue()
Я хочу получить содержимое удаленного файла с тканью, не создавая временный файл.
from StringIO import StringIO
from fabric.api import get
fd = StringIO()
get(remote_path, fd)
content=fd.getvalue()
import tempfile
from fabric.api import get
with tempfile.TemporaryFile() as fd:
get(remote_path, fd)
fd.seek(0)
content=fd.read()
Смотрите: http://docs.python.org/2/library/tempfile.html#tempfile.TemporaryFile
и: http://docs.fabfile.org/en/latest/api/core/operations.html#fabric.operations.get