Client for HexDB. Python 3.9+, standard library only. See ../README.md and the HexDB manual.
HexDB takes a connection URI wherever it takes a URL:
from hexdb import HexDB, parse_connection_uri
db = HexDB("hexdbs://analyst:s3cret%21@db.example.com") # signs in with POST /auth/login
db = HexDB("hexdb://127.0.0.1:7700?apiKey=hxk_...&timeout=10")hexdb://is HTTP, port 7700 by default.hexdbs://is HTTPS, port 443 by default.- A login in the URI signs in when
HexDBis created. Percent-encode@,:and/in the login and password. - The
apiKey,timeoutandcaFileoptions set the API key, the request timeout in seconds and the CA file. Theapi_key,timeoutandca_filearguments win over them; an explicitapi_keyalso skips the sign-in.pageSizeis parsed but not used by this driver. - A path is kept as the base of every request (
hexdbs://example.com/hexdb). - An invalid URI raises
ValueErrornaming the problem. - Plain
http://andhttps://URLs work as before.
parse_connection_uri(uri) returns a ConnectionUri with url, login, password, api_key, timeout_seconds, page_size and ca_file (None when absent). See "Connection URIs" in the HexDB manual for the full format.