File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 11"""A rate limiting module for Ellar"""
22
3- __version__ = "0.1.0 "
3+ __version__ = "0.1.2 "
44
55from .decorators import skip_throttle , throttle
66from .exception import ThrottledException
Original file line number Diff line number Diff line change 22import typing as t
33
44from ellar .common import GuardCanActivate , IExecutionContext , Response
5- from ellar .common .utils import get_name
65from ellar .core .connection import HTTPConnection
76from ellar .core .services import Reflector
87from ellar .di import injectable
8+ from ellar .utils import get_name
99
1010from .constants import THROTTLER_LIMIT , THROTTLER_SKIP , THROTTLER_TTL
1111from .exception import ThrottledException
@@ -60,8 +60,10 @@ def get_request_response(
6060 return connection_host .get_client (), connection_host .get_response ()
6161
6262 def get_tracker (self , connection : HTTPConnection ) -> str :
63- assert connection .client
64- return connection .client .host
63+ if connection .client :
64+ return connection .client .host
65+
66+ return t .cast (str , connection .scope ["server" ][0 ])
6567
6668 def generate_key (self , context : IExecutionContext , suffix : str ) -> str :
6769 prefix = f"{ get_name (context .get_class ())} -{ get_name (context .get_handler ())} "
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ classifiers = [
4040]
4141
4242dependencies = [
43- " ellar >= 0.5.8 "
43+ " ellar >= 0.7.0 "
4444]
4545
4646
You can’t perform that action at this time.
0 commit comments