To use DynaCrop services, you need an API key. It is an ultimate authentication passcode that you can pass to the SDK. We’ll need the SDK Config helper class.

from dynacrop import Config

You can choose to authenticate everytime before utilizing DynaCrop functions (executing API requests) in your code. To do so, initialize the Config class and assign your API key to the api_key keyword parameter.

config = Config()
config.api_key = 'my_api_key'

API key can be added to your user configuration file - config.json, where other configuration data for a user also reside. It will be located in the .dynacrop folder in your user root directory. Beware, that after saving the API Key, this file essentially stores credential data.

You can save the API key like this:


After storing the API key, you no longer have to use the authentication code structure above. If you want to act as a different user on the fly, at the beginning of your script, you simply initialize Config with a different api_key parameter.

config = Config()
config.api_key = 'some_other_api_key'

Unless you save the above configuration, the config.json file remains unchanged.