Spaces:
Sleeping
Sleeping
Download test_db.py from Shevilll/visionattend-api: direct link, hf CLI and curl.
- Browser
- Download file 272 Bytes
-
https://huggingface.co/spaces/Shevilll/visionattend-api/resolve/main/test_db.py
- Command line
-
hf download hf://spaces/Shevilll/visionattend-api/test_db.py
-
curl -L -o test_db.py https://huggingface.co/spaces/Shevilll/visionattend-api/resolve/main/test_db.py
272 Bytes
| import psycopg | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| db_url = os.environ.get("DATABASE_URL") | |
| conn = psycopg.connect(db_url) | |
| print("Connected.", conn.closed) | |
| with conn: | |
| print("Inside with block") | |
| print("After with block, closed:", conn.closed) | |