dagster-dingtalk 0.1.29a1__py3-none-any.whl → 0.1.30__py3-none-any.whl
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.
- dagster_dingtalk/app_client.py +20 -13
- {dagster_dingtalk-0.1.29a1.dist-info → dagster_dingtalk-0.1.30.dist-info}/METADATA +2 -2
- {dagster_dingtalk-0.1.29a1.dist-info → dagster_dingtalk-0.1.30.dist-info}/RECORD +4 -4
- {dagster_dingtalk-0.1.29a1.dist-info → dagster_dingtalk-0.1.30.dist-info}/WHEEL +0 -0
dagster_dingtalk/app_client.py
CHANGED
@@ -48,10 +48,17 @@ class DingTalkClient:
|
|
48
48
|
|
49
49
|
|
50
50
|
def __init_clients(self):
|
51
|
-
self.__oapi_client = httpx.Client(
|
52
|
-
|
53
|
-
|
51
|
+
self.__oapi_client = httpx.Client(
|
52
|
+
base_url="https://oapi.dingtalk.com/",
|
53
|
+
timeout=httpx.Timeout(60.0),
|
54
|
+
limits=httpx.Limits(max_connections=100),
|
55
|
+
)
|
54
56
|
|
57
|
+
self.__api_client = httpx.Client(
|
58
|
+
base_url="https://api.dingtalk.com/",
|
59
|
+
timeout=httpx.Timeout(10.0),
|
60
|
+
limits=httpx.Limits(max_connections=100),
|
61
|
+
)
|
55
62
|
|
56
63
|
def __file_cache_read(self) -> dict:
|
57
64
|
if self.__access_token_file_cache.exists():
|
@@ -64,13 +71,12 @@ class DingTalkClient:
|
|
64
71
|
else:
|
65
72
|
return {}
|
66
73
|
|
67
|
-
def __file_cache_write(self):
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
logging.error(f"AccessToken 缓存写入失败: {e}")
|
74
|
+
def __file_cache_write(self, access_token_cache: dict):
|
75
|
+
try:
|
76
|
+
with open(self.__access_token_file_cache, 'wb') as f:
|
77
|
+
f.write(pickle.dumps(access_token_cache))
|
78
|
+
except Exception as e:
|
79
|
+
logging.error(f"AccessToken 缓存写入失败: {e}")
|
74
80
|
|
75
81
|
def __get_access_token(self) -> str:
|
76
82
|
with self.__token_lock:
|
@@ -87,16 +93,17 @@ class DingTalkClient:
|
|
87
93
|
json={"appKey": self.__client_id, "appSecret": self.__client_secret},
|
88
94
|
).json()
|
89
95
|
# 提前 1 分钟进行续期
|
90
|
-
|
96
|
+
access_token_cache = {
|
91
97
|
"access_token": response.get("accessToken"),
|
92
98
|
"expire_in": response.get("expireIn") + int(time.time()) - 60
|
93
99
|
}
|
94
|
-
self.
|
100
|
+
self.__access_token_cache = access_token_cache
|
101
|
+
self.__file_cache_write(self.__access_token_cache)
|
95
102
|
except Exception as e:
|
96
103
|
logging.error(f"AccessToken 获取失败: {e}")
|
97
104
|
raise
|
98
105
|
|
99
|
-
return
|
106
|
+
return access_token_cache["access_token"]
|
100
107
|
|
101
108
|
def oapi(self, method: str, path: str, **kwargs) -> httpx.Response:
|
102
109
|
params = kwargs.get("params", {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: dagster-dingtalk
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.30
|
4
4
|
Summary: A dagster plugin for the DingTalk
|
5
5
|
Author-email: YiZixuan <sqkkyzx@qq.com>
|
6
6
|
Requires-Python: >=3.11
|
7
|
-
Requires-Dist: dagster
|
7
|
+
Requires-Dist: dagster==1.10.0
|
8
8
|
Requires-Dist: httpx
|
9
9
|
Requires-Dist: pydantic
|
10
10
|
Description-Content-Type: text/markdown
|
@@ -1,9 +1,9 @@
|
|
1
1
|
dagster_dingtalk/__init__.py,sha256=Qw145M6Igl-NXuFUS-SHpKxyqvVboQAksXvhBnv0wBM,425
|
2
|
-
dagster_dingtalk/app_client.py,sha256=
|
2
|
+
dagster_dingtalk/app_client.py,sha256=dCQo0GMkVnEhpMHrbTm4OmCEYfJrrX19XCEVih5O-dg,36052
|
3
3
|
dagster_dingtalk/operations.py,sha256=yH_rXJpWc8rwzkiJqjqHKy5iIED0Xi3qbSOv6SVr-eA,3923
|
4
4
|
dagster_dingtalk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
dagster_dingtalk/resources.py,sha256=RtoK-lbHKknzYDRq1bredLMxHm0GhycJ1IxQ7hjgLBw,17868
|
6
6
|
dagster_dingtalk/version.py,sha256=7jeKY88H3WyDN-Lrs5HYlAPbc4flvLTYlLgkgnZOy-g,26
|
7
|
-
dagster_dingtalk-0.1.
|
8
|
-
dagster_dingtalk-0.1.
|
9
|
-
dagster_dingtalk-0.1.
|
7
|
+
dagster_dingtalk-0.1.30.dist-info/METADATA,sha256=M2rEfThb0FR2vGAIGzTJ1hSncjw9rVPYLF1c-q4yci0,7758
|
8
|
+
dagster_dingtalk-0.1.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
dagster_dingtalk-0.1.30.dist-info/RECORD,,
|
File without changes
|