Configuration

Global configuration is performed by setting attributes on the files_sdk object.

Configuration Options

Base URL

Set this to the full https:// URL of your Files.com subdomain (e.g. https://MY-SUBDOMAIN.files.com). This is not required in most cases, but one benefit of setting it is that it ensures that authentication failures will be logged to your site's API logs. Without setting this, we won't know which site to associate the authentication failure with, and it won't be logged to your site's API logs. This is always required if your site is configured to disable global acceleration. This can also be set to use a mock server in development or CI.

Example setting

import files_sdk

files_sdk.base_url = "https://SUBDOMAIN.files.com"

Log Level

This SDK utilizes the standard Python logging framework. It will respect the global log level and you can set the module specific log level and other logging settings by getting the logger object in the standard manner as shown below:

Example setting

import logging

logging.getLogger("files_sdk")

Console Log Level

Enables printing of messages to stderr in addition to normal logging.

Allowed values are:

  • None
  • "info"
  • "debug"

Example setting

import files_sdk

files_sdk.console_log_level = "info"

Open Timeout

Open timeout in seconds. The default value is 30.

Example setting

import files_sdk

files_sdk.open_timeout = 60

Read Timeout

Read timeout in seconds. The default value is 60.

Example setting

import files_sdk

files_sdk.read_timeout = 90

Initial Network Retry Delay

Initial retry delay in seconds. The default value is 0.5.

Example setting

import files_sdk

files_sdk.initial_network_retry_delay = 1

Maximum Retry Delay

Maximum network retry delay in seconds. The default value is 2.

Example setting

import files_sdk

files_sdk.max_network_retry_delay = 5

Maximum Network Retries

Maximum number of retries. The default value is 3.

Example setting

import files_sdk

files_sdk.max_network_retries = 5

Source IP

Configure the local IP address from which to send requests.

Example setting

import files_sdk

files_sdk.source_ip = '10.1.2.3'