Browse Developer Tooling

beta · sdk · 0.2.0

Python first sandbox request

First verify that Python has a trusted CA store:

Shell example
python3 -c 'import urllib.request; print(urllib.request.urlopen("https://sandbox.minicenter.otus.tw/.well-known/openid-configuration", timeout=10).status)'

For CERTIFICATE_VERIFY_FAILED, repair that Python's CA certificates (python.org macOS installs include Install Certificates.command) or use an approved Python with system trust configured. Never work around this by disabling TLS verification.

Shell example
git clone https://github.com/q10242/MiniCenter.git minicenter-source
test "$(cat minicenter-source/sdks/python/VERSION)" = "0.2.0"
python3 -m pip wheel --no-deps --wheel-dir /tmp ./minicenter-source/sdks/python
python3 -m pip install /tmp/minicenter_sdk-0.2.0-py3-none-any.whl
Python example
import os
from minicenter import Client

correlation_id = os.environ["MINICENTER_CORRELATION_ID"]
client = Client(
    os.environ["MINICENTER_URL"].rstrip("/") + "/api/v1",
    os.environ["MINICENTER_PROJECT_CREDENTIAL"],
    correlation_id=lambda: correlation_id,
)
print(client.request("GET", "/project-client"))
print(f"HTTP 200 correlation_id={correlation_id}")