Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### Changed

- Breaking change: allow usage of the request object in the except_when function (thanks @colin99d)
- Added: allow usage of the request object in the except_when function (thanks @colin99d)
- Added more test exemption logic (thanks @colin99)
- Fix logger warning for Python 3.11 deprecation (thanks @kevin868)

## [0.1.9] - 2024-02-05

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "slowapi"
version = "0.1.9"
version = "0.1.10"
description = "A rate limiting extension for Starlette and Fastapi"
authors = ["Laurent Savaete <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 5 additions & 1 deletion slowapi/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,12 @@ def __evaluate_limits(
limit_for_header = None
for lim in limits:
limit_scope = lim.scope or endpoint
if lim.is_exempt(request):
if getattr(lim, "_exempt_when_takes_request", False):
if lim.is_exempt(request):
continue
elif lim.is_exempt():
continue

if lim.methods is not None and request.method.lower() not in lim.methods:
continue
if lim.per_method:
Expand Down