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
I'm using aoihttp with standard middlewares like this:
from aiohttp import web
from aiohttp_middlewares import error_middleware, https_middleware
async def make_app():
app = web.Application(middlewares=[
error_middleware(ignore_exceptions=web.HTTPFound),
https_middleware(),
])
after upgrading aiohttp package from 3.8.6 to any of 3.9.* verions (tried all of them) I get an error:
ImportError: cannot import name '_Middleware' from 'aiohttp.web_middlewares'
and can't start server anymore.
Would appreciate any information regarding what should I change in my code in order for it to work.
To Reproduce
Upgrade from 3.8.6 to 3.9.0, 3.9.1, 3.9.2 or 3.9.3
Expected behavior
I wan't able to find any upgrade notes, so I assumed that new version should work would any changes to the code.
Logs/tracebacks
Traceback (most recent call last):
File "/Users/nick/work/deploy_server/start_aio.py", line 7, in <module>from aiohttp_middlewares import error_middleware, https_middleware
File "/Users/nick/work/deploy_server/venv/lib/python3.10/site-packages/aiohttp_middlewares/__init__.py", line 14, in <module>from aiohttp_middlewares.cors import cors_middleware
File "/Users/nick/work/deploy_server/venv/lib/python3.10/site-packages/aiohttp_middlewares/cors.py", line 122, in <module>from aiohttp_middlewares.annotations import (
File "/Users/nick/work/deploy_server/venv/lib/python3.10/site-packages/aiohttp_middlewares/annotations.py", line 22, in <module>from aiohttp.web_middlewares import _Middleware as Middleware
ImportError: cannot import name '_Middleware' from 'aiohttp.web_middlewares' (/Users/nick/work/deploy_server/venv/lib/python3.10/site-packages/aiohttp/web_middlewares.py)
### Python Version
```console
$ venv/bin/python --version
Python 3.10.13
Yep, those are not the "standard" middlewares, they are a 3rd party package. If they've not released a fix, then you'll need to open an issue there.
Problem is that they were importing a private variable. We promoted that to a public variable to make it officially part of the API, so it can't find the private one anymore. As per the link above, it appears they've already updated the library to support 3.9+.
Guys, thank you so much for your help! Indeed, the problem was connected to outdated aiohttp-middlewares package and I didn't notice that it's listed separately.
Describe the bug
I'm using aoihttp with standard middlewares like this:
after upgrading aiohttp package from 3.8.6 to any of 3.9.* verions (tried all of them) I get an error:
and can't start server anymore.
Would appreciate any information regarding what should I change in my code in order for it to work.
To Reproduce
Upgrade from 3.8.6 to 3.9.0, 3.9.1, 3.9.2 or 3.9.3
Expected behavior
I wan't able to find any upgrade notes, so I assumed that new version should work would any changes to the code.
Logs/tracebacks
aiohttp Version
multidict Version
yarl Version
OS
macOS 14.3
Related component
Server
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: