Flask app not recognizing async route after upgrade to Python 3.10
I'm working on a personal project and I'm a bit lost with I'm testing a new approach and After trying multiple solutions online, I still can't figure this out. Quick question that's been bugging me - I'm working with an scenario with my Flask application after upgrading to Python 3.10. I've defined an asynchronous route to handle some I/O-bound tasks, but it seems that Flask is not recognizing it as an async route and is blocking the event loop. The route is supposed to fetch data from an external API without blocking the server, but instead, I'm getting a `TypeError: 'coroutine' object is not callable` when I try to access it. Here's the relevant part of my code: ```python from flask import Flask import asyncio import aiohttp app = Flask(__name__) @app.route('/fetch-data') async def fetch_data(): async with aiohttp.ClientSession() as session: async with session.get('https://api.example.com/data') as response: return await response.json() ``` I've made sure that Flask is installed with `pip install Flask==2.1.1`, which I believe should support async routes. I also checked my Python version using `python --version` and confirmed that it's Python 3.10. Despite this, I'm still working with the same behavior. To troubleshoot, I've tried: - Running the app with `flask run` and using both `async` and `await` correctly. - Testing the route with `curl` and Postman, which returns the same behavior. - Verifying that `aiohttp` is installed and up to date with `pip install aiohttp`. - Adding an explicit loop for the asynchronous function, but that didn't resolve the scenario either. Could there be any specific configuration or setup I'm missing in Flask or the async functionality? Any help would be greatly appreciated! My development environment is Ubuntu. Has anyone else encountered this? For context: I'm using Python on macOS. What's the best practice here? I recently upgraded to Python 3.9. I've been using Python for about a year now. Any ideas how to fix this? I'm coming from a different tech stack and learning Python. Any examples would be super helpful. This issue appeared after updating to Python 3.11. Could someone point me to the right documentation?