files.py 文件源码

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

项目:interfax-python 作者: interfax 项目源码 文件源码
def _init_document(self, data, mime_type):
        """Upload the data using the documents API."""
        filename = 'upload-{0}{1}'.format(uuid4(), guess_extension(mime_type))
        document = self.client.documents.create(filename, len(data))

        cursor = 0

        while cursor < len(data):
            chunk = data[cursor:cursor + self.chunk_size]

            document.upload(cursor, cursor + len(chunk) - 1, chunk)
            cursor += len(chunk)

        self._init_url(document.uri)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号