limits 3.10.1__tar.gz → 3.11.0__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.
- {limits-3.10.1 → limits-3.11.0}/CLASSIFIERS +1 -0
- {limits-3.10.1 → limits-3.11.0}/HISTORY.rst +9 -0
- {limits-3.10.1 → limits-3.11.0}/PKG-INFO +3 -2
- {limits-3.10.1 → limits-3.11.0}/limits/_version.py +3 -3
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/mongodb.py +14 -4
- {limits-3.10.1 → limits-3.11.0}/limits/storage/mongodb.py +14 -4
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/PKG-INFO +3 -2
- {limits-3.10.1 → limits-3.11.0}/setup.py +1 -1
- {limits-3.10.1 → limits-3.11.0}/CONTRIBUTIONS.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/LICENSE.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/MANIFEST.in +0 -0
- {limits-3.10.1 → limits-3.11.0}/README.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/Makefile +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/_static/custom.css +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/api.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/async.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/changelog.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/conf.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/custom-storage.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/index.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/installation.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/quickstart.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/storage.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/strategies.rst +0 -0
- {limits-3.10.1 → limits-3.11.0}/doc/source/theme_config.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/__init__.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/__init__.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/__init__.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/base.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/etcd.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/memcached.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/memory.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/storage/redis.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/aio/strategies.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/errors.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/limits.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/py.typed +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/resources/redis/lua_scripts/moving_window.lua +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/__init__.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/base.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/etcd.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/memcached.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/memory.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/redis.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/redis_cluster.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/redis_sentinel.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/storage/registry.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/strategies.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/typing.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/util.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits/version.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/SOURCES.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/dependency_links.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/not-zip-safe +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/requires.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/limits.egg-info/top_level.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/pyproject.toml +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/ci.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/dev.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/docs.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/main.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/async-etcd.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/async-memcached.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/async-mongodb.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/async-redis.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/etcd.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/memcached.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/mongodb.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/redis.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/storage/rediscluster.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/requirements/test.txt +0 -0
- {limits-3.10.1 → limits-3.11.0}/setup.cfg +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_limit_granularities.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_limits.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_ratelimit_parser.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_storage.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_strategy.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/tests/test_utils.py +0 -0
- {limits-3.10.1 → limits-3.11.0}/versioneer.py +0 -0
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
Changelog
|
|
4
4
|
=========
|
|
5
5
|
|
|
6
|
+
v3.11.0
|
|
7
|
+
-------
|
|
8
|
+
Release Date: 2024-04-20
|
|
9
|
+
|
|
10
|
+
* Compatibility
|
|
11
|
+
|
|
12
|
+
* Add support for python 3.12
|
|
13
|
+
|
|
6
14
|
v3.10.1
|
|
7
15
|
-------
|
|
8
16
|
Release Date: 2024-03-17
|
|
@@ -679,5 +687,6 @@ Release Date: 2015-01-08
|
|
|
679
687
|
|
|
680
688
|
|
|
681
689
|
|
|
690
|
+
|
|
682
691
|
|
|
683
692
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: limits
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.0
|
|
4
4
|
Summary: Rate limiting utilities
|
|
5
5
|
Home-page: https://limits.readthedocs.org
|
|
6
6
|
Author: Ali-Akber Saifee
|
|
@@ -18,8 +18,9 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
22
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.8
|
|
23
24
|
License-File: LICENSE.txt
|
|
24
25
|
Requires-Dist: deprecated>=1.2
|
|
25
26
|
Requires-Dist: importlib_resources>=1.3
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2024-
|
|
11
|
+
"date": "2024-04-20T13:09:37-0700",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "3.
|
|
14
|
+
"full-revisionid": "0a1a9c70cbffe4c51a5f34500fe4edfe342de638",
|
|
15
|
+
"version": "3.11.0"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -116,7 +116,11 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
116
116
|
:param key: the key to get the expiry for
|
|
117
117
|
"""
|
|
118
118
|
counter = await self.database.counters.find_one({"_id": key})
|
|
119
|
-
expiry =
|
|
119
|
+
expiry = (
|
|
120
|
+
counter["expireAt"]
|
|
121
|
+
if counter
|
|
122
|
+
else datetime.datetime.now(datetime.timezone.utc)
|
|
123
|
+
)
|
|
120
124
|
|
|
121
125
|
return calendar.timegm(expiry.timetuple())
|
|
122
126
|
|
|
@@ -125,7 +129,10 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
125
129
|
:param key: the key to get the counter value for
|
|
126
130
|
"""
|
|
127
131
|
counter = await self.database.counters.find_one(
|
|
128
|
-
{
|
|
132
|
+
{
|
|
133
|
+
"_id": key,
|
|
134
|
+
"expireAt": {"$gte": datetime.datetime.now(datetime.timezone.utc)},
|
|
135
|
+
},
|
|
129
136
|
projection=["count"],
|
|
130
137
|
)
|
|
131
138
|
|
|
@@ -145,7 +152,9 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
145
152
|
"""
|
|
146
153
|
await self.create_indices()
|
|
147
154
|
|
|
148
|
-
expiration = datetime.datetime.
|
|
155
|
+
expiration = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
|
156
|
+
seconds=expiry
|
|
157
|
+
)
|
|
149
158
|
|
|
150
159
|
response = await self.database.counters.find_one_and_update(
|
|
151
160
|
{"_id": key},
|
|
@@ -252,7 +261,8 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
252
261
|
|
|
253
262
|
updates["$set"] = {
|
|
254
263
|
"expireAt": (
|
|
255
|
-
datetime.datetime.
|
|
264
|
+
datetime.datetime.now(datetime.timezone.utc)
|
|
265
|
+
+ datetime.timedelta(seconds=expiry)
|
|
256
266
|
)
|
|
257
267
|
}
|
|
258
268
|
updates["$push"]["entries"]["$each"] = [timestamp] * amount
|
|
@@ -91,7 +91,11 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
91
91
|
:param key: the key to get the expiry for
|
|
92
92
|
"""
|
|
93
93
|
counter = self.counters.find_one({"_id": key})
|
|
94
|
-
expiry =
|
|
94
|
+
expiry = (
|
|
95
|
+
counter["expireAt"]
|
|
96
|
+
if counter
|
|
97
|
+
else datetime.datetime.now(datetime.timezone.utc)
|
|
98
|
+
)
|
|
95
99
|
|
|
96
100
|
return calendar.timegm(expiry.timetuple())
|
|
97
101
|
|
|
@@ -100,7 +104,10 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
100
104
|
:param key: the key to get the counter value for
|
|
101
105
|
"""
|
|
102
106
|
counter = self.counters.find_one(
|
|
103
|
-
{
|
|
107
|
+
{
|
|
108
|
+
"_id": key,
|
|
109
|
+
"expireAt": {"$gte": datetime.datetime.now(datetime.timezone.utc)},
|
|
110
|
+
},
|
|
104
111
|
projection=["count"],
|
|
105
112
|
)
|
|
106
113
|
|
|
@@ -116,7 +123,9 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
116
123
|
:param expiry: amount in seconds for the key to expire in
|
|
117
124
|
:param amount: the number to increment by
|
|
118
125
|
"""
|
|
119
|
-
expiration = datetime.datetime.
|
|
126
|
+
expiration = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
|
127
|
+
seconds=expiry
|
|
128
|
+
)
|
|
120
129
|
|
|
121
130
|
return int(
|
|
122
131
|
self.counters.find_one_and_update(
|
|
@@ -220,7 +229,8 @@ class MongoDBStorage(Storage, MovingWindowSupport):
|
|
|
220
229
|
|
|
221
230
|
updates["$set"] = {
|
|
222
231
|
"expireAt": (
|
|
223
|
-
datetime.datetime.
|
|
232
|
+
datetime.datetime.now(datetime.timezone.utc)
|
|
233
|
+
+ datetime.timedelta(seconds=expiry)
|
|
224
234
|
)
|
|
225
235
|
}
|
|
226
236
|
updates["$push"]["entries"]["$each"] = [timestamp] * amount
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: limits
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.0
|
|
4
4
|
Summary: Rate limiting utilities
|
|
5
5
|
Home-page: https://limits.readthedocs.org
|
|
6
6
|
Author: Ali-Akber Saifee
|
|
@@ -18,8 +18,9 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
22
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.8
|
|
23
24
|
License-File: LICENSE.txt
|
|
24
25
|
Requires-Dist: deprecated>=1.2
|
|
25
26
|
Requires-Dist: importlib_resources>=1.3
|
|
@@ -58,7 +58,7 @@ setup(
|
|
|
58
58
|
description="Rate limiting utilities",
|
|
59
59
|
long_description=open("README.rst").read(),
|
|
60
60
|
packages=find_packages(exclude=["tests*"]),
|
|
61
|
-
python_requires=">=3.
|
|
61
|
+
python_requires=">=3.8",
|
|
62
62
|
extras_require=EXTRA_REQUIREMENTS,
|
|
63
63
|
include_package_data=True,
|
|
64
64
|
package_data={
|
|
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
|
{limits-3.10.1 → limits-3.11.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|