aligo icon indicating copy to clipboard operation
aligo copied to clipboard

相册照片上传:照片文件上传默认相册成功,但无法返回文件的filelist

Open mohui1999 opened this issue 2 years ago • 3 comments

操作系统信息 MAC os 13.1

错误描述 上传照片到默认相册,无法无法返回文件的filelist

    # Album.py 源代码
    def add_files_to_album(self, album_id: str, files: List[BaseFile]) -> List[BaseFile]:
        print(files)       # 这里获取到的结果
        # [CreateFileResponse(file_name='4.png', type='file', file_id='63de8debba92b7bce4f24ddda883ca168da9fb7a', parent_file_id='root')]
       # 无drive_id
        response = self._post('/adrive/v1/album/add_files', body={
            'album_id': album_id,
            'drive_file_list': [{'drive_id': f.drive_id, 'file_id': f.file_id} for f in files]
        })
        print(response.json())     # 这里获取的结果
        # {'code': 'NotFound.View', 'message': 'The resource view cannot be found. View does not exist. view_id is 9192997', 'resultCode': 'NotFound.View'}
       # 此处的view_id显示的是我的album_id,但是现实无法找到,非默认相册是没有问题的
        return response.json()['file_list']

    def add_file_to_album(self, album_id: str, file: BaseFile) -> BaseFile:
        return self.add_files_to_album(album_id, [file])[0]

image

# 我运行的接口
 f = ali.upload_file(r"/Users/mohui1999/4.png", drive_id=ali.album_info.driveId)
 ali.add_file_to_album(default_album.album_id, f)    # 此处上传到默认相册

mohui1999 avatar Feb 04 '23 17:02 mohui1999

这个方法写得太随意了,我改改😂

lemisky avatar Feb 05 '23 02:02 lemisky

你说的问题,没有发现,可能你的相册id不对

lemisky avatar Feb 05 '23 03:02 lemisky

https://github.com/foyoux/aligo/issues/161

lemisky avatar Mar 13 '24 04:03 lemisky