48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
|
|
import couchdb
|
||
|
|
from urllib.parse import quote
|
||
|
|
|
||
|
|
# Configuration
|
||
|
|
user = "admin"
|
||
|
|
password = "DonCucarach0!?"
|
||
|
|
ip_address = "100.100.112.48"
|
||
|
|
port = "5984"
|
||
|
|
db_name = "obsidiandb"
|
||
|
|
|
||
|
|
# Safe URL Construction
|
||
|
|
safe_password = quote(password, safe="")
|
||
|
|
# Using HTTP as requested for the IP address
|
||
|
|
url = f"http://{user}:{safe_password}@{ip_address}:{port}/"
|
||
|
|
|
||
|
|
print(f"Attempting connection to: http://{ip_address}:{port}/")
|
||
|
|
print(f"Target Database: {db_name}")
|
||
|
|
|
||
|
|
try:
|
||
|
|
# 1. Connect
|
||
|
|
server = couchdb.Server(url)
|
||
|
|
# Testing authentication by getting server info
|
||
|
|
version = server.version()
|
||
|
|
print(f"✅ Server Connected! Version: {version}")
|
||
|
|
|
||
|
|
# 2. Check Database
|
||
|
|
if db_name in server:
|
||
|
|
db = server[db_name]
|
||
|
|
print(f"✅ Database '{db_name}' found.")
|
||
|
|
print(f"📊 Total Documents: {len(db)}")
|
||
|
|
|
||
|
|
# 3. List some docs
|
||
|
|
docs = [id for id in db if not id.startswith("_design")]
|
||
|
|
print(f"Found {len(docs)} non-design documents.")
|
||
|
|
if docs:
|
||
|
|
print("First doc ID:", docs[0])
|
||
|
|
|
||
|
|
else:
|
||
|
|
print(f"❌ Database '{db_name}' NOT found.")
|
||
|
|
print("Available Databases:", list(server))
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f"\n❌ Connection Failed: {e}")
|
||
|
|
print("\nTroubleshooting tips:")
|
||
|
|
print("1. Verify Tailscale is active and pinging 100.100.112.48 works.")
|
||
|
|
print("2. Check if CouchDB is configured to allow 'admin' login via HTTP.")
|
||
|
|
print("3. Ensure the password 'DonCucarach0?' is exactly correct.")
|