Getting started

Setup

Supported Python: 3.7, 3.8, 3.9, 3.10, and 3.11

1 pip install kpler.sdk

Upgrade an existing installation:

1pip install kpler.sdk --upgrade

You can be notified about new available Python SDK versions via a log message at each Configuration object creation. In order to see that log message, you must set the log level to Info :

1config = Configuration(Platform.Liquids, "<your email>", "<your password>", log_level="INFO")

Example of update message : "A new versions 1.2.3 is available, please upgrade the Kpler SDK."

Authentication

Create a Configuration with the targeted Platform, your email and password to pass it to the client:

1from kpler.sdk.configuration import Configuration
2from kpler.sdk import Platform
3config = Configuration(Platform.Liquids, "<your email>", "<your password>")
4
5from kpler.sdk.resources.trades import Trades
6trades_client = Trades(config)

Available platforms:

  • LNG

  • LPG

  • Dry

  • Liquids

Access behind a proxy

Proxies configuration can be passed to the Configuration as an additional dict parameter:

1proxies = {
2   "http" : "http:////proxy.mycompany.com:1234",
3   "https" : "http:////proxy.mycompany.com:1234"
4}
5
6config = Configuration(Platform.Liquids, "login", "password", proxies)

SSL troubleshooting

If you’re experiencing SSL issues, you can try one of the following :

Client side certificates

You can specify your own certificate, as a single file (containing the private key and the certificate) or as a tuple of both files:

1cert=('/path/client.cert', '/path/client.key')
2config = Configuration(Platform.Liquids, "login", "password", certificate=cert)

Disable SSL verification

Disclaimer : the certificate verification is made to prevent man-in-the-middle attacks, use it at your own risks.

You can disable ssl verification :

1config = Configuration(Platform.Liquids, "login", "password", verify=False)