limits 3.10.0__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.
Files changed (82) hide show
  1. {limits-3.10.0 → limits-3.11.0}/CLASSIFIERS +1 -0
  2. {limits-3.10.0 → limits-3.11.0}/HISTORY.rst +18 -0
  3. {limits-3.10.0 → limits-3.11.0}/PKG-INFO +4 -3
  4. {limits-3.10.0 → limits-3.11.0}/limits/_version.py +3 -3
  5. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/mongodb.py +14 -4
  6. {limits-3.10.0 → limits-3.11.0}/limits/storage/mongodb.py +14 -4
  7. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/PKG-INFO +4 -3
  8. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/requires.txt +1 -1
  9. {limits-3.10.0 → limits-3.11.0}/requirements/main.txt +1 -1
  10. {limits-3.10.0 → limits-3.11.0}/setup.py +1 -1
  11. {limits-3.10.0 → limits-3.11.0}/CONTRIBUTIONS.rst +0 -0
  12. {limits-3.10.0 → limits-3.11.0}/LICENSE.txt +0 -0
  13. {limits-3.10.0 → limits-3.11.0}/MANIFEST.in +0 -0
  14. {limits-3.10.0 → limits-3.11.0}/README.rst +0 -0
  15. {limits-3.10.0 → limits-3.11.0}/doc/Makefile +0 -0
  16. {limits-3.10.0 → limits-3.11.0}/doc/source/_static/custom.css +0 -0
  17. {limits-3.10.0 → limits-3.11.0}/doc/source/api.rst +0 -0
  18. {limits-3.10.0 → limits-3.11.0}/doc/source/async.rst +0 -0
  19. {limits-3.10.0 → limits-3.11.0}/doc/source/changelog.rst +0 -0
  20. {limits-3.10.0 → limits-3.11.0}/doc/source/conf.py +0 -0
  21. {limits-3.10.0 → limits-3.11.0}/doc/source/custom-storage.rst +0 -0
  22. {limits-3.10.0 → limits-3.11.0}/doc/source/index.rst +0 -0
  23. {limits-3.10.0 → limits-3.11.0}/doc/source/installation.rst +0 -0
  24. {limits-3.10.0 → limits-3.11.0}/doc/source/quickstart.rst +0 -0
  25. {limits-3.10.0 → limits-3.11.0}/doc/source/storage.rst +0 -0
  26. {limits-3.10.0 → limits-3.11.0}/doc/source/strategies.rst +0 -0
  27. {limits-3.10.0 → limits-3.11.0}/doc/source/theme_config.py +0 -0
  28. {limits-3.10.0 → limits-3.11.0}/limits/__init__.py +0 -0
  29. {limits-3.10.0 → limits-3.11.0}/limits/aio/__init__.py +0 -0
  30. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/__init__.py +0 -0
  31. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/base.py +0 -0
  32. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/etcd.py +0 -0
  33. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/memcached.py +0 -0
  34. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/memory.py +0 -0
  35. {limits-3.10.0 → limits-3.11.0}/limits/aio/storage/redis.py +0 -0
  36. {limits-3.10.0 → limits-3.11.0}/limits/aio/strategies.py +0 -0
  37. {limits-3.10.0 → limits-3.11.0}/limits/errors.py +0 -0
  38. {limits-3.10.0 → limits-3.11.0}/limits/limits.py +0 -0
  39. {limits-3.10.0 → limits-3.11.0}/limits/py.typed +0 -0
  40. {limits-3.10.0 → limits-3.11.0}/limits/resources/redis/lua_scripts/acquire_moving_window.lua +0 -0
  41. {limits-3.10.0 → limits-3.11.0}/limits/resources/redis/lua_scripts/clear_keys.lua +0 -0
  42. {limits-3.10.0 → limits-3.11.0}/limits/resources/redis/lua_scripts/incr_expire.lua +0 -0
  43. {limits-3.10.0 → limits-3.11.0}/limits/resources/redis/lua_scripts/moving_window.lua +0 -0
  44. {limits-3.10.0 → limits-3.11.0}/limits/storage/__init__.py +0 -0
  45. {limits-3.10.0 → limits-3.11.0}/limits/storage/base.py +0 -0
  46. {limits-3.10.0 → limits-3.11.0}/limits/storage/etcd.py +0 -0
  47. {limits-3.10.0 → limits-3.11.0}/limits/storage/memcached.py +0 -0
  48. {limits-3.10.0 → limits-3.11.0}/limits/storage/memory.py +0 -0
  49. {limits-3.10.0 → limits-3.11.0}/limits/storage/redis.py +0 -0
  50. {limits-3.10.0 → limits-3.11.0}/limits/storage/redis_cluster.py +0 -0
  51. {limits-3.10.0 → limits-3.11.0}/limits/storage/redis_sentinel.py +0 -0
  52. {limits-3.10.0 → limits-3.11.0}/limits/storage/registry.py +0 -0
  53. {limits-3.10.0 → limits-3.11.0}/limits/strategies.py +0 -0
  54. {limits-3.10.0 → limits-3.11.0}/limits/typing.py +0 -0
  55. {limits-3.10.0 → limits-3.11.0}/limits/util.py +0 -0
  56. {limits-3.10.0 → limits-3.11.0}/limits/version.py +0 -0
  57. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/SOURCES.txt +0 -0
  58. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/dependency_links.txt +0 -0
  59. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/not-zip-safe +0 -0
  60. {limits-3.10.0 → limits-3.11.0}/limits.egg-info/top_level.txt +0 -0
  61. {limits-3.10.0 → limits-3.11.0}/pyproject.toml +0 -0
  62. {limits-3.10.0 → limits-3.11.0}/requirements/ci.txt +0 -0
  63. {limits-3.10.0 → limits-3.11.0}/requirements/dev.txt +0 -0
  64. {limits-3.10.0 → limits-3.11.0}/requirements/docs.txt +0 -0
  65. {limits-3.10.0 → limits-3.11.0}/requirements/storage/async-etcd.txt +0 -0
  66. {limits-3.10.0 → limits-3.11.0}/requirements/storage/async-memcached.txt +0 -0
  67. {limits-3.10.0 → limits-3.11.0}/requirements/storage/async-mongodb.txt +0 -0
  68. {limits-3.10.0 → limits-3.11.0}/requirements/storage/async-redis.txt +0 -0
  69. {limits-3.10.0 → limits-3.11.0}/requirements/storage/etcd.txt +0 -0
  70. {limits-3.10.0 → limits-3.11.0}/requirements/storage/memcached.txt +0 -0
  71. {limits-3.10.0 → limits-3.11.0}/requirements/storage/mongodb.txt +0 -0
  72. {limits-3.10.0 → limits-3.11.0}/requirements/storage/redis.txt +0 -0
  73. {limits-3.10.0 → limits-3.11.0}/requirements/storage/rediscluster.txt +0 -0
  74. {limits-3.10.0 → limits-3.11.0}/requirements/test.txt +0 -0
  75. {limits-3.10.0 → limits-3.11.0}/setup.cfg +0 -0
  76. {limits-3.10.0 → limits-3.11.0}/tests/test_limit_granularities.py +0 -0
  77. {limits-3.10.0 → limits-3.11.0}/tests/test_limits.py +0 -0
  78. {limits-3.10.0 → limits-3.11.0}/tests/test_ratelimit_parser.py +0 -0
  79. {limits-3.10.0 → limits-3.11.0}/tests/test_storage.py +0 -0
  80. {limits-3.10.0 → limits-3.11.0}/tests/test_strategy.py +0 -0
  81. {limits-3.10.0 → limits-3.11.0}/tests/test_utils.py +0 -0
  82. {limits-3.10.0 → limits-3.11.0}/versioneer.py +0 -0
@@ -9,4 +9,5 @@ Programming Language :: Python :: 3.8
9
9
  Programming Language :: Python :: 3.9
10
10
  Programming Language :: Python :: 3.10
11
11
  Programming Language :: Python :: 3.11
12
+ Programming Language :: Python :: 3.12
12
13
  Programming Language :: Python :: Implementation :: PyPy
@@ -3,6 +3,22 @@
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
+
14
+ v3.10.1
15
+ -------
16
+ Release Date: 2024-03-17
17
+
18
+ * Compatibility
19
+
20
+ * Relax dependency constraint on packaging
21
+
6
22
  v3.10.0
7
23
  -------
8
24
  Release Date: 2024-03-08
@@ -669,6 +685,8 @@ Release Date: 2015-01-08
669
685
 
670
686
 
671
687
 
688
+
689
+
672
690
 
673
691
 
674
692
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: limits
3
- Version: 3.10.0
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,12 +18,13 @@ 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.7
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
26
- Requires-Dist: packaging<24,>=21
27
+ Requires-Dist: packaging<25,>=21
27
28
  Requires-Dist: typing_extensions
28
29
  Provides-Extra: redis
29
30
  Requires-Dist: redis!=4.5.2,!=4.5.3,<6.0.0,>3; extra == "redis"
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-03-08T18:55:44-0800",
11
+ "date": "2024-04-20T13:09:37-0700",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "60e2708acab26f37c3ed97615deb0cf22d4a7026",
15
- "version": "3.10.0"
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 = counter["expireAt"] if counter else datetime.datetime.utcnow()
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
- {"_id": key, "expireAt": {"$gte": datetime.datetime.utcnow()}},
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.utcnow() + datetime.timedelta(seconds=expiry)
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.utcnow() + datetime.timedelta(seconds=expiry)
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 = counter["expireAt"] if counter else datetime.datetime.utcnow()
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
- {"_id": key, "expireAt": {"$gte": datetime.datetime.utcnow()}},
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.utcnow() + datetime.timedelta(seconds=expiry)
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.utcnow() + datetime.timedelta(seconds=expiry)
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.10.0
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,12 +18,13 @@ 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.7
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
26
- Requires-Dist: packaging<24,>=21
27
+ Requires-Dist: packaging<25,>=21
27
28
  Requires-Dist: typing_extensions
28
29
  Provides-Extra: redis
29
30
  Requires-Dist: redis!=4.5.2,!=4.5.3,<6.0.0,>3; extra == "redis"
@@ -1,6 +1,6 @@
1
1
  deprecated>=1.2
2
2
  importlib_resources>=1.3
3
- packaging<24,>=21
3
+ packaging<25,>=21
4
4
  typing_extensions
5
5
 
6
6
  [all]
@@ -1,4 +1,4 @@
1
1
  deprecated>=1.2
2
2
  importlib_resources>=1.3
3
- packaging>=21,<24
3
+ packaging>=21,<25
4
4
  typing_extensions
@@ -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.7",
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
File without changes
File without changes
File without changes
File without changes