Frequently Asked Questions#
How Do I Choose Which Browser default_authenticate() Opens?#
default_authenticate() tries to open a supported
local browser. Set the LA_AUTH_BROWSER environment variable to choose which
one.
export LA_AUTH_BROWSER=chrome
export LA_AUTH_BROWSER=firefox
export LA_AUTH_BROWSER=edge
export LA_AUTH_BROWSER=terminal
Supported values are chrome, firefox, edge (or msedge), and
terminal;
terminal prints the URL instead of opening a browser.
Example:
import os
from labapi import Client
os.environ["LA_AUTH_BROWSER"] = "firefox"
with Client() as client:
user = client.default_authenticate()
How Do I Handle SSL/TLS Certificate Issues?#
By default, Client verifies TLS certificates on every
HTTPS request.
How Do I Connect From Behind a TLS-Inspecting Proxy?#
Corporate and institutional networks often inspect HTTPS traffic with a proxy
that re-signs certificates using a private root CA installed only in the
operating system’s trust store. Pass ssl_host_bundle=True to verify
certificates against that store (the Windows certificate store, the macOS
Keychain, or the Linux system CA bundle). Certificates are still fully
verified, so prefer this option. It requires the truststore extra:
pip install "labapi[truststore]"
from labapi import Client
client = Client(
base_url="https://api.labarchives.com",
akid="your_access_key_id",
akpass="your_password",
ssl_host_bundle=True,
)
Can I Disable Strict Certificate Verification?#
Use ssl_host_bundle=True (see above) instead. The strict_cert option
is deprecated: passing it emits a DeprecationWarning, it has no
effect when ssl_host_bundle=True, and it will be removed in a future
release. Until then, strict_cert=False still relaxes strict X.509
validation of the default certificate bundle.
Warning
strict_cert=False can expose you to man-in-the-middle attacks. Do not
use it in production or on networks you do not control.
How Do I Trust a Custom CA Bundle Instead?#
If your network uses a private certificate authority, add that CA to a trusted bundle.
Find the active certifi bundle with:
python -c "import certifi; print(certifi.where())"
Then either append your CA certificate to that bundle or point
REQUESTS_CA_BUNDLE at a custom bundle:
export REQUESTS_CA_BUNDLE=/path/to/your/ca-bundle.crt
from labapi import Client
client = Client()
What Should I Check When Authentication Fails?#
Verify that
ACCESS_KEYIDandACCESS_PWDare set correctly.If the browser does not open, set
LA_AUTH_BROWSER=terminalfor manual authentication, or install thebuiltin-authextra for browser launching.A certificate failure raises
TransportErrorwith a message startingSSLError during request to. Use the guidance above to trust your CA bundle.If you use
generate_auth_url(), make sure the redirect URL exactly matches the callback URL your app handles.
pip install "labapi[builtin-auth]"