Configuring the Python bindings

The pero Python library connects to your organization's compatible API. Download the package from installation instructions. Bots can use it with the compatible bot framework. The package has not been published to PyPI.

In order to use them, you need to configure them with your identity (account, API key, and your organization's server URL). There are a few ways to achieve that:

  • Using a perorc file, referenced via the --config-file option or the config_file option to the pero.Client constructor (recommended for bots).
  • Using a perorc file in your home directory at ~/.perorc, the default path used by pero (recommended for your own API key).
  • Using the environment variables documented here.
  • Using the --api-key, --user, and --site variables as command line parameters.
  • Using the api_key, email, and site parameters to the pero.Client constructor.

A separate configuration file

import pero

client = pero.Client(config_file="/path/to/bot.perorc")

The file contains the organization's address and the bot's credentials:

[api]
email=<bot email address>
key=<bot API key>
site=https://chat.example.com

Replace chat.example.com with your organization's address. Use separate configuration files for different customers. When switching environments, check site and the owner of the API key. Command-line parameters can appear in shell history or process listings; for working integrations, keep the key in a protected file or secret store.

Connecting to different deployments

For SaaS and operator-hosted deployments, use the organization's assigned HTTPS address. For on-premises and hybrid deployments, the integration's runtime must be able to reach the server from its network. A carrier or reseller's application name does not determine the API address. Do not substitute another customer's or a public server's address if the private server is unavailable.

For on-premises with a private certificate authority, configure cert_bundle. Keep TLS verification enabled for working integrations.

The API key authorizes your account or bot; it is separate from BYOK encryption keys. Do not put storage or backup encryption keys in perorc. Arrange those keys with the administrator responsible for the deployment.