File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ class GenericMeta(type):
42
42
fastapi = None
43
43
44
44
45
+ try :
46
+ import starlette .requests
47
+ except ImportError :
48
+ starlette = None
49
+
50
+
45
51
try :
46
52
import werkzeug .local
47
53
except ImportError :
@@ -257,16 +263,18 @@ class InspectFilter:
257
263
def is_excluded (self , instance : object ) -> bool :
258
264
if self ._is_werkzeug_local_proxy (instance ):
259
265
return True
260
- elif self ._is_fastapi_request (instance ):
266
+ elif self ._is_starlette_request_cls (instance ):
261
267
return True
262
268
else :
263
269
return False
264
270
265
271
def _is_werkzeug_local_proxy (self , instance : object ) -> bool :
266
272
return werkzeug and isinstance (instance , werkzeug .local .LocalProxy )
267
273
268
- def _is_fastapi_request (self , instance : object ) -> bool :
269
- return fastapi and isinstance (instance , fastapi .Request )
274
+ def _is_starlette_request_cls (self , instance : object ) -> bool :
275
+ return starlette \
276
+ and isinstance (instance , type ) \
277
+ and issubclass (instance , starlette .requests .Request )
270
278
271
279
272
280
inspect_filter = InspectFilter ()
You can’t perform that action at this time.
0 commit comments