upload.py 文件源码

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

项目:canvasapi 作者: ucfopen 项目源码 文件源码
def request_upload_token(self, file):
        """
        Request an upload token.

        :param file: A file handler pointing to the file to upload.
        :returns: True if the file uploaded successfully, False otherwise, \
            and the JSON response from the API.
        :rtype: tuple
        """
        self.kwargs['name'] = os.path.basename(file.name)
        self.kwargs['size'] = os.fstat(file.fileno()).st_size

        response = self._requester.request(
            'POST',
            self.url,
            _kwargs=combine_kwargs(**self.kwargs)
        )

        return self.upload(response, file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号