p123client 0.0.6.5__tar.gz → 0.0.6.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {p123client-0.0.6.5 → p123client-0.0.6.6}/PKG-INFO +1 -1
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/client.py +8 -5
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/tool/__init__.py +2 -5
- {p123client-0.0.6.5 → p123client-0.0.6.6}/pyproject.toml +1 -1
- {p123client-0.0.6.5 → p123client-0.0.6.6}/LICENSE +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/__init__.py +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/const.py +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/exception.py +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/py.typed +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/p123client/type.py +0 -0
- {p123client-0.0.6.5 → p123client-0.0.6.6}/readme.md +0 -0
@@ -4655,7 +4655,7 @@ class P123Client(P123OpenClient):
|
|
4655
4655
|
:params payload: 文件 id 或者文件信息,文件信息必须包含的信息如下:
|
4656
4656
|
|
4657
4657
|
- FileID: int | str 💡 下载链接
|
4658
|
-
- S3KeyFlag: str 💡
|
4658
|
+
- S3KeyFlag: str 💡 s3 存储名
|
4659
4659
|
- Etag: str 💡 文件的 MD5 散列值
|
4660
4660
|
- Size: int 💡 文件大小
|
4661
4661
|
- FileName: str 💡 默认用 Etag(即 MD5)作为文件名,可以省略
|
@@ -7046,8 +7046,10 @@ class P123Client(P123OpenClient):
|
|
7046
7046
|
if async_:
|
7047
7047
|
async def request():
|
7048
7048
|
chunks = bio_chunk_async_iter(file, chunksize=slice_size) # type: ignore
|
7049
|
-
|
7049
|
+
slice_no = 1
|
7050
7050
|
async for chunk in chunks:
|
7051
|
+
upload_data["partNumberStart"] = slice_no
|
7052
|
+
upload_data["partNumberEnd"] = slice_no + 1
|
7051
7053
|
resp = await self.upload_prepare(
|
7052
7054
|
upload_data,
|
7053
7055
|
base_url=base_url,
|
@@ -7056,17 +7058,18 @@ class P123Client(P123OpenClient):
|
|
7056
7058
|
)
|
7057
7059
|
check_response(resp)
|
7058
7060
|
await self.request(
|
7059
|
-
resp["data"]["presignedUrls"][
|
7061
|
+
resp["data"]["presignedUrls"][str(slice_no)],
|
7060
7062
|
data=chunk,
|
7061
7063
|
async_=True,
|
7062
7064
|
**upload_request_kwargs,
|
7063
7065
|
)
|
7064
|
-
|
7066
|
+
slice_no += 1
|
7065
7067
|
yield request()
|
7066
7068
|
else:
|
7067
7069
|
chunks = bio_chunk_iter(file, chunksize=slice_size) # type: ignore
|
7068
7070
|
for slice_no, chunk in enumerate(chunks, 1):
|
7069
7071
|
upload_data["partNumberStart"] = slice_no
|
7072
|
+
upload_data["partNumberEnd"] = slice_no + 1
|
7070
7073
|
resp = self.upload_prepare(
|
7071
7074
|
upload_data,
|
7072
7075
|
base_url=base_url,
|
@@ -7074,7 +7077,7 @@ class P123Client(P123OpenClient):
|
|
7074
7077
|
)
|
7075
7078
|
check_response(resp)
|
7076
7079
|
self.request(
|
7077
|
-
resp["data"]["presignedUrls"][
|
7080
|
+
resp["data"]["presignedUrls"][str(slice_no)],
|
7078
7081
|
data=chunk,
|
7079
7082
|
**upload_request_kwargs,
|
7080
7083
|
)
|
@@ -194,19 +194,16 @@ def get_downurl(
|
|
194
194
|
size = int(size_s)
|
195
195
|
if s3_key_flag:
|
196
196
|
payload = {
|
197
|
-
"S3KeyFlag": s3_key_flag,
|
198
197
|
"FileName": name,
|
199
198
|
"Etag": md5,
|
200
199
|
"Size": size,
|
200
|
+
"S3KeyFlag": s3_key_flag,
|
201
201
|
}
|
202
202
|
else:
|
203
|
-
resp = yield client.fs_mkdir("我的秒传", async_=async_, **request_kwargs)
|
204
|
-
check_response(resp)
|
205
203
|
resp = yield client.upload_file_fast(
|
204
|
+
file_name=".tempfile",
|
206
205
|
file_md5=md5,
|
207
|
-
file_name=f"{md5}-{size}",
|
208
206
|
file_size=size,
|
209
|
-
parent_id=resp["data"]["Info"]["FileId"],
|
210
207
|
duplicate=2,
|
211
208
|
async_=async_,
|
212
209
|
**request_kwargs,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|