---
title: Python SDK Configuration
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

The Python SDK (Async or Sync) client can be configured using an instance of the `Config` class.

<Tabs groupId="async-sync">
  <TabItem value="Async" default>

  ```python
  from infrahub_sdk import Config, InfrahubClient
  config = Config(address="http://infrahub:8080", api_token="123-xyz-invalid-token")
  client = InfrahubClient(config=config)
  ```

  </TabItem>
  <TabItem value="Sync">

  ```python
  from infrahub_sdk import Config, InfrahubClientSync
  config = Config(address="http://infrahub:8080", api_token="123-xyz-invalid-token")
  client = InfrahubClientSync(config=config)
  ```

  </TabItem>
</Tabs>

The following settings can be defined in the `Config` class
<!-- vale off -->
## address
<!-- vale on -->
**Description**: The URL to use when connecting to Infrahub.<br />
**Type**: `string`<br />
**Default value**: http://localhost:8000<br />
**Environment variable**: `INFRAHUB_ADDRESS`<br />
<!-- vale off -->
## api_token
<!-- vale on -->
**Description**: API token for authentication against Infrahub.<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_API_TOKEN`<br />
<!-- vale off -->
## echo_graphql_queries
<!-- vale on -->
**Description**: If set the GraphQL query and variables will be echoed to the screen<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_ECHO_GRAPHQL_QUERIES`<br />
<!-- vale off -->
## username
<!-- vale on -->
**Description**: Username for accessing Infrahub<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_USERNAME`<br />
<!-- vale off -->
## password
<!-- vale on -->
**Description**: Password for accessing Infrahub<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_PASSWORD`<br />
<!-- vale off -->
## default_branch
<!-- vale on -->
**Description**: Default branch to target if not specified for each request.<br />
**Type**: `string`<br />
**Default value**: main<br />
**Environment variable**: `INFRAHUB_DEFAULT_BRANCH`<br />
<!-- vale off -->
## default_branch_from_git
<!-- vale on -->
**Description**: Indicates if the default Infrahub branch to target should come from the active branch in the local Git repository.<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_DEFAULT_BRANCH_FROM_GIT`<br />
<!-- vale off -->
## identifier
<!-- vale on -->
**Description**: Tracker identifier<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_IDENTIFIER`<br />
<!-- vale off -->
## insert_tracker
<!-- vale on -->
**Description**: Insert a tracker on queries to the server<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_INSERT_TRACKER`<br />
<!-- vale off -->
## max_concurrent_execution
<!-- vale on -->
**Description**: Max concurrent execution in batch mode<br />
**Type**: `integer`<br />
**Default value**: 5<br />
**Environment variable**: `INFRAHUB_MAX_CONCURRENT_EXECUTION`<br />
<!-- vale off -->
## mode
<!-- vale on -->
**Description**: Default mode for the client<br />
**Type**: `object`<br />
**Environment variable**: `INFRAHUB_MODE`<br />
<!-- vale off -->
## pagination_size
<!-- vale on -->
**Description**: Page size for queries to the server<br />
**Type**: `integer`<br />
**Default value**: 50<br />
**Environment variable**: `INFRAHUB_PAGINATION_SIZE`<br />
<!-- vale off -->
## retry_delay
<!-- vale on -->
**Description**: Number of seconds to wait until attempting a retry.<br />
**Type**: `integer`<br />
**Default value**: 5<br />
**Environment variable**: `INFRAHUB_RETRY_DELAY`<br />
<!-- vale off -->
## retry_on_failure
<!-- vale on -->
**Description**: Retry operation in case of failure<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_RETRY_ON_FAILURE`<br />
<!-- vale off -->
## max_retry_duration
<!-- vale on -->
**Description**: Maximum duration until we stop attempting to retry if enabled.<br />
**Type**: `integer`<br />
**Default value**: 300<br />
**Environment variable**: `INFRAHUB_MAX_RETRY_DURATION`<br />
<!-- vale off -->
## schema_converge_timeout
<!-- vale on -->
**Description**: Number of seconds to wait for schema to have converged<br />
**Type**: `integer`<br />
**Default value**: 60<br />
**Environment variable**: `INFRAHUB_SCHEMA_CONVERGE_TIMEOUT`<br />
<!-- vale off -->
## timeout
<!-- vale on -->
**Description**: Default connection timeout in seconds<br />
**Type**: `integer`<br />
**Default value**: 60<br />
**Environment variable**: `INFRAHUB_TIMEOUT`<br />
<!-- vale off -->
## transport
<!-- vale on -->
**Description**: Set an alternate transport using a predefined option<br />
**Type**: `object`<br />
**Environment variable**: `INFRAHUB_TRANSPORT`<br />
<!-- vale off -->
## proxy
<!-- vale on -->
**Description**: Proxy address<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_PROXY`<br />
<!-- vale off -->
## proxy_mounts
<!-- vale on -->
**Description**: Proxy mounts configuration<br />
**Type**: `object`<br />
**Environment variable**: `INFRAHUB_PROXY_MOUNTS`<br />
<!-- vale off -->
## marketplace_url
<!-- vale on -->
**Description**: Base URL for the Infrahub Marketplace.<br />
**Type**: `string`<br />
**Default value**: https://marketplace.infrahub.app<br />
**Environment variable**: `INFRAHUB_MARKETPLACE_URL`<br />
<!-- vale off -->
## update_group_context
<!-- vale on -->
**Description**: Update GraphQL query groups<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_UPDATE_GROUP_CONTEXT`<br />
<!-- vale off -->
## tls_insecure
<!-- vale on -->
**Description**:  
    Indicates if TLS certificates are verified.
    Enabling this option will disable: CA verification, expiry date verification, hostname verification).
    Can be useful to test with self-signed certificates.<br />
**Type**: `boolean`<br />
**Default value**: False<br />
**Environment variable**: `INFRAHUB_TLS_INSECURE`<br />
<!-- vale off -->
## tls_ca_file
<!-- vale on -->
**Description**: File path to CA cert or bundle in PEM format<br />
**Type**: `string`<br />
**Environment variable**: `INFRAHUB_TLS_CA_FILE`<br />

<!-- vale off -->
## recorder

**Property**: recorder<br />
<!-- vale on -->
**Description**: Select builtin recorder for later replay.<br />
**Type**: `RecorderType`<br />
**Default value**: RecorderType.NONE <br />

<!-- vale off -->
## custom_recorder

**Property**: custom_recorder<br />
<!-- vale on -->
**Description**: Provides a way to record responses from the Infrahub API<br />
**Type**: `Recorder` (protocol) <br />
**Default value**: NoRecorder.default <br />

<!-- vale off -->
## requester

**Property**: requester<br />
<!-- vale on -->
**Type**: `AsyncRequester`<br />
**Default value**: None <br />

<!-- vale off -->
## sync_requester

**Property**: sync_requester<br />
<!-- vale on -->
**Type**: `SyncRequester`<br />
**Default value**: None <br />