Comments (3)
hey man , you can try to contribute the relevant changes , best of luck
from slowapi.
Please add the error traceback that you got, will help to resolve the issue much faster.
from slowapi.
I solved it using custom decorator
def dynamic_scope_limiter():
def decorator(func: Callable[..., Awaitable]):
@functools.wraps(func)
async def wrapper(*args, **kwargs):
scope="dynamic"
@quota_limiter.shared_limit(
lambda: "10/day",
key_func=lambda: "user",
scope=scope
)
async def limit(request): # Add the "request" argument
return await func(*args, **kwargs)
return await limit(request) # Pass the "request" argument
return wrapper
return decorator
from slowapi.
Related Issues (20)
- Hi @smittysmee this is not my day job, it's 100% volunteer work, so priority may fall behind. The process for publishing an update is a bit manual still. If you want to give a hand with opening a PR to prepare for a release 0.1.8, I think a lot of people will be grateful. Examples from past releases #120 or #108. As a policy (see #58 ), I add any contributor who's had at least one PR merged to the repo, to help reduce bottlenecks. You're welcome to join the team!
- Features
- Feature | Can this support individual limits by IP address or user token? HOT 1
- slowapi uses limits==2.8.0 which contains usage of deprecated pkg_resources
- add multiple limiters on a single route. HOT 15
- The limiters of different routes with the same function name are confused, resulting in multiple checks HOT 1
- [Ehancement] Don't require `Request` parameter to be present in endpoint function signature. HOT 4
- Add as package in arch user repository
- Exception: No "request" or "websocket" argument on function HOT 3
- Need Rate Limiting on Basis of Request Body for a POST API HOT 1
- mypy error: type of `_rate_limit_exceeded_handler` is incompatible with latest starlette HOT 1
- Wrong parsing of limit_value when having more than one decorator HOT 1
- `request` parameter unable to be renamed HOT 1
- Consider avoiding BaseHTTPMiddleware as parent of SlowAPIMiddleware HOT 2
- [Feature request] - Limiter global `exempt_when` option
- {Token, User}-dependent rate limit control HOT 9
- dynamic_limit isn't really dynamic HOT 2
- There is 'cp949' encoding error in Windows
- Real traceback is lost in case of any internal error (AttributeError: 'XXX' object has no attribute 'detail')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slowapi.