Changelog
April 10, 2024 · View on GitHub
v0.8.1 - 2024-04-10
Fixed
- 修复保持分享链接根目录出错。
Changed
updateuser命令中也更新 tokens。
v0.8.0 - 2024-04-09
Add new apis and remove unneeded apis.
Inner datas
-
PcsFile class
-
pathDefault is the name of the file. It will be different from different apis returned. See
AliPCSApi.meta,AliPCSApi.meta_by_path,AliPCSApi.get_file,AliPCSApi.list,AliPCSApi.list_iter,AliPCSApi.path_traceback,AliPCSApi.path. -
update_download_urlThe method is removed. Use
AliPCSApi.update_download_urlinstead.
-
-
FromTo type
The original
FromTois a nametuple. We change it to a general typeFromTo = Tuple[F, T] -
PcsDownloadUrl class
-
expiresAdd the method to check whether the
download_urlexpires.
-
Errors
-
AliPCSBaseError class
The base Exception class used for the PCS errors.
-
AliPCSError(AliPCSBaseError) class
The error returned from alipan server when the client’s request is incorrect or the token is expired.
It throw at AliPCS class when an error occurs.
-
DownloadError(AliPCSBaseError) class
An error occurs when downloading action fails.
-
UploadError(AliPCSBaseError) class
An error occurs when uploading action fails.
-
RapidUploadError(UploadError) class
An error occurred when rapid uploading action fails.
-
make_alipcs_error function
Make an AliPCSError instance.
-
handle_error function
uses the
_error_max_retriesattribute of the wrapped method’s class to retry.
Core APIs
-
AliPCS class
class AliPCS: SHARE_AUTHS: Dict[str, SharedAuth] = {} def __init__( self, refresh_token: str, access_token: str = "", token_type: str = "Bearer", expire_time: int = 0, user_id: str = "", user_name: str = "", nick_name: str = "", device_id: str = "", default_drive_id: str = "", role: str = "", status: str = "", error_max_retries: int = 2, max_keepalive_connections: int = 50, max_connections: int = 50, keepalive_expiry: float = 10 * 60, connection_max_retries: int = 2, ): ...The core alipan.com service apis. It directly handles the raw requests and responses of the service.
New/Changed APIs are following:
-
path_tracebackmethod (New)Traceback the path of the file by its file_id. Return the list of all parent directories' info from the file to the top level directory.
-
meta_by_pathmethod (New)Get meta info of the file by its path.
Can not get the shared files' meta info.
-
metamethod (Changed)Get meta info of the file by its file_id.
-
existsmethod (Changed)Check whether the file exists. Return True if the file exists and does not in the trash else False.
-
exists_in_trashmethod (New)Check whether the file exists in the trash. Return True if the file exists in the trash else False.
-
walkmethod (New)Walk through the directory tree by its file_id.
-
download_linkmethod (Changed)Get download link of the file by its file_id.
First try to get the download link from the meta info of the file. If the download link is not in the meta info, then request the getting download url api.
-
-
AliPCSApi class
class AliPCSApi: def __init__( self, refresh_token: str, access_token: str = "", token_type: str = "", expire_time: int = 0, user_id: str = "", user_name: str = "", nick_name: str = "", device_id: str = "", default_drive_id: str = "", role: str = "", status: str = "", error_max_retries: int = 2, max_keepalive_connections: int = 50, max_connections: int = 50, keepalive_expiry: float = 10 * 60, connection_max_retries: int = 2, ): ...The core alipan.com service api with wrapped AliPCS class. It parses the raw content of response of AliPCS request into the inner data structions.
-
New/Changed APIs are following:
-
path_tracebackmethod (New)Traceback the path of the file. Return the list of all
PcsFiles from the file to the top level directory.Important: The
pathproperty of the returnedPcsFilehas absolute path. -
meta_by_pathmethod (New)Get the meta of the the path. Can not get the shared files' meta info by their paths.
Important: The
pathproperty of the returnedPcsFileis the argumentremotepath. -
metamethod (Changed)Get meta info of the file.
Important: The
pathproperty of the returnedPcsFileis only the name of the file. -
get_filemethod (New)Get the file's info by the given
remotepathorfile_idIf the
remotepathis given, thefile_idwill be ignored.Important: If the
remotepathis given, thepathproperty of the returnedPcsFileis theremotepath. If thefile_idis given, thepathproperty of the returnedPcsFileis only the name of the file. -
existsmethod (Changed)Check whether the file exists. Return True if the file exists and does not in the trash else False.
-
exists_in_trashmethod (Changed)Check whether the file exists in the trash. Return True if the file exists in the trash else False.
-
listmethod (Changed)List files and directories in the given directory (which has the
file_id). The return items size is limited by thelimitparameter. If you want to list more, using the returnednext_markerparameter for nextlistcall.Important: These PcsFile instances' path property is only the name of the file.
-
list_itermethod (Changed)Iterate all files and directories at the directory (which has the
file_id).These returned PcsFile instances' path property is the path from the first sub-directory of the
file_idto the file name. e.g. If the directory (ownedfile_id) has pathlevel0/, a sub-directory which of path islevel0/level1/level2then its corresponding PcsFile.path islevel1/level2. -
pathmethod (Changed)Get the pcs file's info by the given absolute
remotepathImportant: The
pathproperty of the returnedPcsFileis the argumentremotepath. -
list_pathmethod (Removed) -
list_path_itermethod (Removed) -
walkmethod (New)Recursively Walk through the directory tree which has
file_id.Important: These PcsFile instances' path property is the path from the first sub-directory of the
file_idto the file. e.g. If the directory (ownedfile_id) has pathlevel0/, a sub-directory which of path islevel0/level1/level2then its corresponding PcsFile.path islevel1/level2. -
makedirmethod (Changed)Make a directory in the
dir_iddirectoryImportant: The
pathproperty of the returnedPcsFileis only the name of the directory. -
makedir_path method (Changed)
Make a directory by the absolute
remotedirpathReturn the list of all
PcsFiles from the directory to the top level directory.Important: The
pathproperty of the returnedPcsFilehas absolute path. -
renamemethod (Changed)Rename the file with
file_idtonameImportant: The
pathproperty of the returnedPcsFileis only the name of the file. -
copymethod (Changed)Copy
file_ids[:-1]tofile_ids[-1]Important: The
pathproperty of the returnedPcsFileis only the name of the file. -
update_download_urlmethod (New)Update the download url of the
pcs_fileif it is expired.Return a new
PcsFilewith the updated download url.
-
-
Download
-
MeDownloader class
class MeDownloader: def __init__( self, range_request_io: RangeRequestIO, localpath: PathType, continue_: bool = False, max_retries: int = 2, done_callback: Optional[Callable[..., Any]] = None, except_callback: Optional[Callable[[Exception], Any]] = None, ) -> None: ... -
download module
-
DownloadParamsclass (Removed)We remove the
DownloadParamsinstead of using arguments for function calling. -
download_filefunction (Changed)download_filedownloads one remote file to one local directory. Raise any error occurred. So giving the upper level caller to handle errors. -
downloadfunction (Changed)downloadfunction downloads any number of remote files/directory to one local directory. It uses aThreadPoolExecutorto download files concurrently and raise the exception if any error occurred.
-
-
upload module
-
UploadTypeclass (Removed)Alipan.com only support to upload a file through uploading slice parts one by one.
So, the class is not needed.
-
upload_filefunction (Changed)Upload a file from one local file (
from_to[0]) to remote (from_to[1]).First try to rapid upload, if failed, then upload file's slices.
Raise exception if any error occurs.
-
uploadfunction (Changed)Upload files in
from_to_listto Alipan Drive.Use a
ThreadPoolExecutorto upload files concurrently.Raise exception if any error occurs.
-
v0.7.0 - 2024-04-03
Updated
MeDownloader剥离线程池,让上层函数来控制。- 不在
upload_file函数上进行重试,让上层函数来控制。 PcsFile.update_download_url将在下个版本删除。请该用AliPCSApi.update_download_url。RangeRequestIO增加read_iter方法。- 使用
python-dateutil库来解析时间。
Fixed
- 修复播放分享文件时的暂停问题。
v0.6.3 - 2024-02-04
Updated
- 减少上传时对文件检查的 api 请求。
- 支持 Python 3.8 ~ 3.12
v0.6.2 - 2023-12-04
Fixed
- 修复上传链接超时
Updated
- 根新依赖
v0.6.1 - 2023-05-09
Fixed
- 修复下载进度条太长的问题。
v0.6.0 - 2023-04-24
New Feature
- 支持 阿里云盘开放平台 api。
v0.5.3 - 2023-02-28
Updated
- 因为
device_id不再在AliPCS.user_info中返回,需要把运行环境中的device_id加入到user_info。
v0.5.2 - 2023-02-25
Fixed
- 修复
DeviceSessionSignatureInvalid报错。支持自动更新signature。
v0.5.1 - 2023-02-22
Fixed
- 修复
ls命令输出省略结果。 (#11)
v0.5.0 - 2023-02-15
Updated
- 使用临时 API 接口,让下载可用。
v0.4.1 - 2023-02-02
Fixed
- 修复安装失败。
Updated
- 更新依赖。
v0.4.0 - 2023-01-09
Breaking Changes
-
下面几个 api 都增加了参数
part_number。AliPCS.create_fileAliPCS.prepare_fileAliPCSApi.create_fileAliPCSApi.prepare_file
part_number指明上传的该文件需要分几次上传。 这个参数需要用户自己计算出来。一般用ceiling(上传文件大小 / 单个上传分片大小),其中一般单个上传分片大小建议为80MB。
Fixed
- 修复上传大于 100G 的文件失败的问题。 (#4)
- 修复播出路径出错的问题。
v0.3.4 - 2022-12-16
Fixed
- 修复删除用户错误。 (#3)
v0.3.3 - 2022-12-10
Updated
- 更新
AliPCS.metaapi。
v0.3.2 - 2022-12-04
Added
listsharedlinks命令支持分页。
Changed
- 在下载和上传时,让调用者去初始化进度条。
Fixed
- 修复不完整上传错误。
- 修复上传时创建多个同名目录的问题。
- 修复同步失败的问题。
- 修复
ls,download,play,search中--include-regex选项。
Updated
- 更新依赖。
v0.3.1 - 2022-10-26
Fixed
- 修复同步命令(
sync)错误。 - 修复下载连接过期的问题。
Added
- 删除命令(
remove)支持--file-id参数。
v0.3.0 - 2022-09-24
Added
-
支持保存分享连接至本地
可以将他人分享了连接保存至本地,而不需要保存在网盘。这只作为一个记录。在需要是提供查看搜索功能。
使用这个功能,需要使用者在本地配置文件(
~/.alipcs-py/config.toml)中配置:[share] store = true提供以下命令:
命令 描述 storesharedlinks 保存分享连接至本地 listsharedlinks 显示本地保存的分享连接 listsharedfiles 显示本地保存的分享文件 findsharedlinks 查找本地保存的分享连接 findsharedfiles 查找本地保存的分享文件 findshared 查找本地保存的分享连接和文件 deletestoredshared 删除本地保存的分享连接或文件 cleanstore 清理本地保存的无效分享连接
v0.2.5 - 2022-01-15
Updated
- 更新依赖。
Changed
- 阿里网盘不支持单文件并发上传。
upload --upload-type One失效。
v0.2.4 - 2021-10-12
Added
- 支持 alywp.net 的分享连接。
Fixed
- 修复
upload -t One - 修复
ls,download,play用于分享连接。
Changed
- 改
play命令选项--play缩写为--pl
v0.2.3 - 2021-09-24
Fixed
- 重复列出分享根目录。
Changed
ls,download,play命令用于分享 url 或 id 时,必须指定路径或 file id。
v0.2.2 - 2021-09-23
Fixed
- 修复保存分享连接根目录出错。
v0.2.1 - 2021-09-23
Added
- 支持下载、播放他人分享的文件。
listsharedpaths命令合并到ls。- 支持保存他人分享连接中的特定文件。
v0.1.0 - 2021-09-19
Runnable version