Skip to content

Commit ae6d86e

Browse files
authored
Merge pull request #43 from Menghuan1918/dev
0.4.3
2 parents e5e6d6d + 8de747f commit ae6d86e

File tree

3 files changed

+174
-146
lines changed

3 files changed

+174
-146
lines changed

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pdfdeal"
3-
version = "0.4.2"
3+
version = "0.4.3"
44
authors = [{ name = "Menghuan1918", email = "[email protected]" }]
55
description = "A python wrapper for the Doc2X API and comes with native texts processing (to improve texts recall in RAG)."
66
readme = "README.md"
@@ -10,7 +10,7 @@ classifiers = [
1010
"License :: OSI Approved :: MIT License",
1111
"Operating System :: OS Independent",
1212
]
13-
dependencies = ["httpx<=0.25.2", "pypdf"]
13+
dependencies = ["httpx>=0.23.1, <1", "pypdf"]
1414

1515
[project.optional-dependencies]
1616
rag = ["emoji", "Pillow", "reportlab", "oss2", "boto3"]

src/pdfdeal/Doc2X/Exception.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
async def code_check(code: str, uid: str = None, trace_id: str = None):
10-
if code in ["parse_task_limit_exceeded", "parse_concurrency_limit"]:
10+
if code in ["parse_page_limit_exceeded", "parse_concurrency_limit"]:
1111
raise RateLimit()
1212
if code in RequestError.ERROR_CODES:
1313
raise RequestError(code, uid=uid, trace_id=trace_id)
@@ -20,7 +20,8 @@ class RateLimit(Exception):
2020
Error when rate limit is reached.
2121
"""
2222

23-
pass
23+
def __str__(self):
24+
return "Rate limit reached. Please wait a moment and try again. (速率限制,请稍后重试)"
2425

2526

2627
class RequestError(Exception):
@@ -29,7 +30,7 @@ class RequestError(Exception):
2930
"""
3031

3132
ERROR_CODES = {
32-
"parse_page_limit_exceeded": "可用的解析页数额度不足 (Insufficient page quota)",
33+
"parse_quota_limit": "可用的解析页数额度不足 (Insufficient parsing quota)",
3334
"parse_create_task_error": "创建任务失败 (Failed to create task)",
3435
"parse_file_too_large": "单个文件大小超过限制 (File size exceeds limit)",
3536
"parse_file_page_limit": "单个文件页数超过限制 (File page count exceeds limit)",
@@ -42,7 +43,7 @@ class RequestError(Exception):
4243
}
4344

4445
SOLUTIONS = {
45-
"parse_page_limit_exceeded": "当前可用的页数不够 (Not enough available pages)",
46+
"parse_quota_limit": "当前可用的页数不足,请检查余额或联系负责人 (Insufficient parsing quota, check balance or contact support)",
4647
"parse_create_task_error": "短暂等待后重试, 如果还出现报错则请联系负责人 (Retry after a short wait, contact support if error persists)",
4748
"parse_file_too_large": "当前允许单个文件大小 <= 300M, 请拆分 pdf (File size must be <= 300MB, please split the PDF)",
4849
"parse_file_page_limit": "当前允许单个文件页数 <= 1000页, 请拆分 pdf (File page count must be <= 1000 pages, please split the PDF)",

0 commit comments

Comments
 (0)