mdbq 4.2.10__tar.gz → 4.2.11__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.

Potentially problematic release.


This version of mdbq might be problematic. Click here for more details.

Files changed (46) hide show
  1. {mdbq-4.2.10 → mdbq-4.2.11}/PKG-INFO +1 -1
  2. mdbq-4.2.11/mdbq/__version__.py +1 -0
  3. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/auth/crypto.py +41 -7
  4. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/redis/redis_cache.py +5 -0
  5. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq.egg-info/PKG-INFO +1 -1
  6. mdbq-4.2.10/mdbq/__version__.py +0 -1
  7. {mdbq-4.2.10 → mdbq-4.2.11}/README.txt +0 -0
  8. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/__init__.py +0 -0
  9. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/auth/__init__.py +0 -0
  10. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/auth/auth_backend.py +0 -0
  11. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/auth/rate_limiter.py +0 -0
  12. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/js/__init__.py +0 -0
  13. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/js/jc.py +0 -0
  14. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/log/__init__.py +0 -0
  15. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/log/mylogger.py +0 -0
  16. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/myconf/__init__.py +0 -0
  17. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/myconf/myconf.py +0 -0
  18. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/__init__.py +0 -0
  19. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/deduplicator.py +0 -0
  20. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/mysql.py +0 -0
  21. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/s_query.py +0 -0
  22. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/unique_.py +0 -0
  23. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/mysql/uploader.py +0 -0
  24. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/__init__.py +0 -0
  25. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/download_sku_picture.py +0 -0
  26. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/error_handler.py +0 -0
  27. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/otk.py +0 -0
  28. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/pov_city.py +0 -0
  29. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/other/ua_sj.py +0 -0
  30. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/pbix/__init__.py +0 -0
  31. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/pbix/pbix_refresh.py +0 -0
  32. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/pbix/refresh_all.py +0 -0
  33. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/redis/__init__.py +0 -0
  34. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/redis/getredis.py +0 -0
  35. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/route/__init__.py +0 -0
  36. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/route/analytics.py +0 -0
  37. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/route/monitor.py +0 -0
  38. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/route/routes.py +0 -0
  39. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/selenium/__init__.py +0 -0
  40. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/selenium/get_driver.py +0 -0
  41. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq/spider/__init__.py +0 -0
  42. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq.egg-info/SOURCES.txt +0 -0
  43. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq.egg-info/dependency_links.txt +0 -0
  44. {mdbq-4.2.10 → mdbq-4.2.11}/mdbq.egg-info/top_level.txt +0 -0
  45. {mdbq-4.2.10 → mdbq-4.2.11}/setup.cfg +0 -0
  46. {mdbq-4.2.10 → mdbq-4.2.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdbq
3
- Version: 4.2.10
3
+ Version: 4.2.11
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -0,0 +1 @@
1
+ VERSION = '4.2.11'
@@ -175,8 +175,29 @@ class CryptoService:
175
175
  def decrypt_token(self, encrypted_token: str) -> Optional[Dict[str, Any]]:
176
176
  """解密令牌"""
177
177
  try:
178
+ # 验证输入参数
179
+ if not encrypted_token or not isinstance(encrypted_token, str):
180
+ self.logger.error("无效的加密令牌")
181
+ return None
182
+
178
183
  # 解析加密数据
179
- encrypted_data = json.loads(base64.b64decode(encrypted_token))
184
+ try:
185
+ encrypted_data = json.loads(base64.b64decode(encrypted_token))
186
+ except (json.JSONDecodeError, ValueError, TypeError) as e:
187
+ self.logger.error(f"解析加密数据失败: {str(e)}")
188
+ return None
189
+
190
+ # 验证数据类型
191
+ if not isinstance(encrypted_data, dict):
192
+ self.logger.error("加密数据格式错误,应为字典类型")
193
+ return None
194
+
195
+ # 验证必要的字段是否存在
196
+ required_fields = ['key', 'iv', 'ciphertext']
197
+ for field in required_fields:
198
+ if field not in encrypted_data:
199
+ self.logger.error(f"加密数据缺少必要字段: {field}")
200
+ return None
180
201
 
181
202
  # 获取私钥
182
203
  private_key = self.key_manager.get_private_key()
@@ -185,7 +206,11 @@ class CryptoService:
185
206
  return None
186
207
 
187
208
  # 解密AES密钥
188
- encrypted_aes_key = base64.b64decode(encrypted_data['key'])
209
+ try:
210
+ encrypted_aes_key = base64.b64decode(encrypted_data['key'])
211
+ except (ValueError, TypeError) as e:
212
+ self.logger.error(f"解码AES密钥失败: {str(e)}")
213
+ return None
189
214
 
190
215
  # 使用SHA-512加密算法
191
216
  try:
@@ -199,16 +224,25 @@ class CryptoService:
199
224
  )
200
225
  except Exception as decrypt_error:
201
226
  self.logger.error("RSA解密失败", {'error': str(decrypt_error)})
227
+ return None
202
228
 
203
229
  # 解密数据
204
- iv = base64.b64decode(encrypted_data['iv'])
205
- ciphertext = base64.b64decode(encrypted_data['ciphertext'])
230
+ try:
231
+ iv = base64.b64decode(encrypted_data['iv'])
232
+ ciphertext = base64.b64decode(encrypted_data['ciphertext'])
233
+ except (ValueError, TypeError) as e:
234
+ self.logger.error(f"解码IV或密文失败: {str(e)}")
235
+ return None
206
236
 
207
237
  # 检查是否有认证标签(AES-GCM需要)
208
238
  if 'tag' in encrypted_data:
209
- tag = base64.b64decode(encrypted_data['tag'])
210
- # tag附加到密文末尾(AES-GCM标准做法)
211
- ciphertext_with_tag = ciphertext + tag
239
+ try:
240
+ tag = base64.b64decode(encrypted_data['tag'])
241
+ # tag附加到密文末尾(AES-GCM标准做法)
242
+ ciphertext_with_tag = ciphertext + tag
243
+ except (ValueError, TypeError) as e:
244
+ self.logger.error(f"解码认证标签失败: {str(e)}")
245
+ return None
212
246
  else:
213
247
  # 如果没有tag,假设密文已经包含tag
214
248
  ciphertext_with_tag = ciphertext
@@ -1131,6 +1131,11 @@ def _safe_cache_set(cache_system, cache_key, response_data, ttl, namespace,
1131
1131
  if not status_ok:
1132
1132
  return False
1133
1133
 
1134
+ # 检查 message 字段是否包含"失败"字样,如果包含则跳过缓存
1135
+ message = data.get('message', '')
1136
+ if isinstance(message, str) and ('失败' in message or 'error' in message or 'fail' in message):
1137
+ return False
1138
+
1134
1139
  # 检查数据部分(支持多种数据字段名)
1135
1140
  has_data_fields = (
1136
1141
  'data' in data or # 标准data字段
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdbq
3
- Version: 4.2.10
3
+ Version: 4.2.11
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1 +0,0 @@
1
- VERSION = '4.2.10'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes