This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import time | |
| import aiohttp | |
| import requests | |
| from typing import List, Callable | |
| def get_user_info(user_id: int) -> dict | None: | |
| response = requests.get(f"http://127.0.0.1:8000/user/{user_id}").json() | |
| if 'ok' not in response or not response['ok']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| from fastapi import FastAPI, Depends | |
| from starlette.websockets import WebSocket | |
| import redis.asyncio as redis | |
| app = FastAPI() | |
| redis_connection_pool = redis.ConnectionPool( | |
| host='...', |
NewerOlder