workos-python icon indicating copy to clipboard operation
workos-python copied to clipboard

support setting client_id and api_key as class variables

Open castrapel opened this issue 1 year ago • 1 comments

Currently, Python SDK users need to monkeypatch WorkOS SDK by setting a client_id and api_key at the module level. This is an anti-pattern because the object's definition doesn't describe how it actually behaves. A better practice would be the ability to pass in api_key and client_id when instantiating a client. An example:

import workos
workos_client = workos.client(api_key, client_id)

or

import workos
workos_client = workos.client
workos_client.api_key = "..."
workos_client.client_id = "..."

Although we can set the class variables today, workos needs them set at the module level:

image

castrapel avatar Nov 25 '22 20:11 castrapel