INNER CODE UNIT · Python

dispatch

georgekhananaev/google-reviews-scraper-pro · api_server.py:142

    async def dispatch(self, request: Request, call_next) -> Response:
        start = time.monotonic()
        response = await call_next(request)
        elapsed_ms = int((time.monotonic() - start) * 1000)

        api_key_db = getattr(request.app.state, "api_key_db", None)
        if api_key_db is None:
            return response

        key_info = getattr(request.state, "api_key_info", None) if hasattr(request.state, "api_key_info") else None
        key_id = key_info["id"] if key_info else None
        key_name = key_info["name"] if key_info else None
        client_ip = request.client.host if request.client else None

        try:
            api_key_db.log_request(
                key_id=key_id,
                key_name=key_name,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…