SMBProtocol.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:xunfengES 作者: superhuahua 项目源码 文件源码
def storeFile(self, service_name, path, file_obj, timeout = 30):
        """
        Store the contents of the *file_obj* at *path* on the *service_name*.

        The meaning of the *timeout* parameter will be different from other file operation methods. As the uploaded file usually exceeeds the maximum size
        of each SMB/CIFS data message, it will be packetized into a series of messages (usually about 60kBytes).
        The *timeout* parameter is an integer/float value that specifies the timeout interval for these individual SMB/CIFS message to be transmitted and acknowledged
        by the remote SMB/CIFS server.

        :param string/unicode service_name: the name of the shared folder for the *path*
        :param string/unicode path: Path of the file on the remote server. If the file at *path* does not exist, it will be created. Otherwise, it will be overwritten.
                                    If the *path* refers to a folder or the file cannot be opened for writing, an :doc:`OperationFailure<smb_exceptions>` will be called in the returned *Deferred* errback.
        :param file_obj: A file-like object that has a *read* method. Data will read continuously from *file_obj* until EOF.
        :return: A *twisted.internet.defer.Deferred* instance. The callback function will be called with a 2-element tuple of ( *file_obj*, number of bytes uploaded ).
        """
        if not self.instance:
            raise NotConnectedError('Not connected to server')

        d = defer.Deferred()
        self.instance._storeFile(service_name, path, file_obj, d.callback, d.errback, timeout = timeout)
        return d
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号