Initial commit: SIBU 2.0 MISSION
This commit is contained in:
25
backend/check_db_async.py
Normal file
25
backend/check_db_async.py
Normal file
@ -0,0 +1,25 @@
|
||||
import asyncio
|
||||
import asyncpg
|
||||
|
||||
async def check_db():
|
||||
creds = [
|
||||
("sibu", "sibu", "sibu"),
|
||||
("postgres", "postgres", "postgres"),
|
||||
("postgres", "postgres", "sibu"),
|
||||
("postgres", "", "postgres"),
|
||||
("sibu", "", "sibu"),
|
||||
]
|
||||
|
||||
for user, pw, db in creds:
|
||||
url = f"postgresql://{user}:{pw}@localhost:5432/{db}"
|
||||
print(f"Testing {url}...")
|
||||
try:
|
||||
conn = await asyncpg.connect(url, timeout=5)
|
||||
print(f"!!! SUCCESS with {url} !!!")
|
||||
await conn.close()
|
||||
return
|
||||
except Exception as e:
|
||||
print(f"Failed: {type(e).__name__}: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(check_db())
|
||||
Reference in New Issue
Block a user