At the moment the client is configured by passing a dictionary. This is not strongly typed and easy to make mistakes, as well as not being pythonic. We should replace this with an object with named fields, and separate the host from the port.
In addition, the host and port should be optional (same with the config), and if not set we detect the OS and use localhost with the relevant port. This way you can do the following:
pieces_client - PiecesClient()
And it will use localhost:1000 for macOS/windows, and localhost:5323 on Linux. Abstracting boilerplate logic like this is one of the benefits of a good SDK.
At the moment the client is configured by passing a dictionary. This is not strongly typed and easy to make mistakes, as well as not being pythonic. We should replace this with an object with named fields, and separate the host from the port.
becomes
In addition, the host and port should be optional (same with the config), and if not set we detect the OS and use localhost with the relevant port. This way you can do the following:
And it will use
localhost:1000
for macOS/windows, andlocalhost:5323
on Linux. Abstracting boilerplate logic like this is one of the benefits of a good SDK.