You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from sanic import Sanic, Blueprint
from sanic_jwt import Initialize
app = Sanic("TestCase")
bp = Blueprint('bp', url_prefix='/api')
app.blueprint(bp)
bp1 = Blueprint('bp1', url_prefix='/test')
app.blueprint(bp1)
Initialize(
instance=bp,
app=app,
authenticate=lambda: True
)
Initialize(
instance=bp1,
app=app,
authenticate=lambda: True
)
print('app', app.router.routes_all.keys())
print('bp', [x.uri for x in bp.routes])
This code gives me following Error. Looks like bug, i don't understand why.
Traceback (most recent call last):
File "/home/deffuls/Documents/Example/test.py", line 20, in <module>
Initialize(
File "/home/deffuls/Documents/Example/env_py/lib/python3.11/site-packages/sanic_jwt/initialization.py", line 137, in __init__
self.__add_endpoints()
File "/home/deffuls/Documents/Example/env_py/lib/python3.11/site-packages/sanic_jwt/initialization.py", line 179, in __add_endpoints
self.app.exception(exceptions.SanicJWTException)(
File "/home/deffuls/Documents/Example/env_py/lib/python3.11/site-packages/sanic/mixins/exceptions.py", line 37, in decorator
self._apply_exception_handler(future_exception)
File "/home/deffuls/Documents/Example/env_py/lib/python3.11/site-packages/sanic/app.py", line 517, in _apply_exception_handler
self.error_handler.add(exception, handler.handler, route_names)
File "/home/deffuls/Documents/Example/env_py/lib/python3.11/site-packages/sanic/handlers/error.py", line 73, in add
self._add((exception, None), handler)
File "/home/deffuls/Documents/Exampleenv_py/lib/python3.11/site-packages/sanic/handlers/error.py", line 53, in _add
raise ServerError(message)
sanic.exceptions.ServerError: Duplicate exception handler definition on: route=__ALL_ROUTES__ and exception=<class 'sanic_jwt.exceptions.SanicJWTException'>
The text was updated successfully, but these errors were encountered:
This code gives me following Error. Looks like bug, i don't understand why.
The text was updated successfully, but these errors were encountered: