mdbq 4.0.99__tar.gz → 4.0.100__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.
- {mdbq-4.0.99 → mdbq-4.0.100}/PKG-INFO +1 -1
- mdbq-4.0.100/mdbq/__version__.py +1 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/auth/rate_limiter.py +11 -3
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq.egg-info/PKG-INFO +1 -1
- mdbq-4.0.99/mdbq/__version__.py +0 -1
- {mdbq-4.0.99 → mdbq-4.0.100}/README.txt +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/auth/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/auth/auth_backend.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/js/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/js/jc.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/log/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/log/mylogger.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/myconf/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/myconf/myconf.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/deduplicator.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/mysql.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/s_query.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/unique_.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/mysql/uploader.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/download_sku_picture.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/error_handler.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/otk.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/pov_city.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/other/ua_sj.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/pbix/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/pbix/pbix_refresh.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/pbix/refresh_all.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/redis/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/redis/getredis.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/route/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/route/analytics.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/route/monitor.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/route/routes.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/selenium/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/selenium/get_driver.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq/spider/__init__.py +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq.egg-info/SOURCES.txt +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq.egg-info/dependency_links.txt +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/mdbq.egg-info/top_level.txt +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/setup.cfg +0 -0
- {mdbq-4.0.99 → mdbq-4.0.100}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = '4.0.100'
|
|
@@ -260,8 +260,10 @@ class AdvancedRateLimiter:
|
|
|
260
260
|
window_start = current_time - rule.window
|
|
261
261
|
|
|
262
262
|
if key not in self.storage:
|
|
263
|
-
self.storage[key]
|
|
263
|
+
self.storage[key] = {'requests': deque(), 'last_access': current_time}
|
|
264
264
|
|
|
265
|
+
# 更新最后访问时间
|
|
266
|
+
self.storage[key]['last_access'] = current_time
|
|
265
267
|
requests = self.storage[key]['requests']
|
|
266
268
|
|
|
267
269
|
# 清理过期请求
|
|
@@ -286,9 +288,12 @@ class AdvancedRateLimiter:
|
|
|
286
288
|
if key not in self.storage:
|
|
287
289
|
self.storage[key] = {
|
|
288
290
|
'tokens': rule.requests,
|
|
289
|
-
'last_refill': current_time
|
|
291
|
+
'last_refill': current_time,
|
|
292
|
+
'last_access': current_time
|
|
290
293
|
}
|
|
291
294
|
|
|
295
|
+
# 更新最后访问时间
|
|
296
|
+
self.storage[key]['last_access'] = current_time
|
|
292
297
|
bucket = self.storage[key]
|
|
293
298
|
|
|
294
299
|
# 计算需要添加的令牌数
|
|
@@ -313,8 +318,10 @@ class AdvancedRateLimiter:
|
|
|
313
318
|
|
|
314
319
|
with self.locks[key]:
|
|
315
320
|
if key not in self.storage:
|
|
316
|
-
self.storage[key] = {'count': 0, 'window_start': window_start}
|
|
321
|
+
self.storage[key] = {'count': 0, 'window_start': window_start, 'last_access': current_time}
|
|
317
322
|
|
|
323
|
+
# 更新最后访问时间
|
|
324
|
+
self.storage[key]['last_access'] = current_time
|
|
318
325
|
data = self.storage[key]
|
|
319
326
|
|
|
320
327
|
# 检查是否是新窗口
|
|
@@ -373,6 +380,7 @@ class AdvancedRateLimiter:
|
|
|
373
380
|
violations['count'] = 1
|
|
374
381
|
|
|
375
382
|
violations['last_time'] = current_time
|
|
383
|
+
violations['last_access'] = current_time
|
|
376
384
|
self.storage[violation_key] = violations
|
|
377
385
|
|
|
378
386
|
# 连续违规超过阈值,进行阻断
|
mdbq-4.0.99/mdbq/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '4.0.99'
|
|
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
|
|
File without changes
|