Server-Side Scripting/Key-Value Databases/Python (FastAPI)

routers/lesson11.py
"   return result

def country_exists(country): redis = redis_lib.Redis(host=HOST, db=DATABASE) return bool(redis.exists(country))

def insert_country(country, temperature): redis = redis_lib.Redis(host=HOST, db=DATABASE) redis.set(country, temperature)

def update_country(country, temperature): redis = redis_lib.Redis(host=HOST, db=DATABASE) redis.set(country, temperature)

def delete_country(country): redis = redis_lib.Redis(host=HOST, db=DATABASE) redis.delete(country)

Try It
See ../../Routes and Templates/Python (FastAPI) to create a test environment.