LogoLogo
About
  • Home
  • Guides
  • BDK
  • REST API
  • BDK Overview
  • Planning Guide
  • Setup Guide
  • Development Guide
  • Deployment
  • Learning a BDK Book
  • Connection Commands
  • BDK API Reference
    • Concepts
    • Connections
    • Decorators
      • @book
      • @concept
      • @config
      • @connect
      • @oauth
      • @oauthtoken
      • @procedure
    • Docstrings
    • Enums
      • FilterBinaryOperator
      • FilterUnaryOperator
    • Filter Expressions
    • Noun Phrases
    • Procedures
Powered by GitBook
On this page
  • Overview
  • Syntax
  • Keyword Arguments
  • Example

Was this helpful?

Export as PDF
  1. BDK API Reference
  2. Decorators

@config

Overview

The config decorator is used to decorate a property in a Book class that defines default configuration values.

Syntax

@config(*args, **kwargs)

Keyword Arguments

Argument
Type
Required
Description

name

str

Optional

Specifies the name of the configuration. If not provided, the function name or value from *args is used.

default_value

Any

Optional

Specifies the default value for the configuration. If not provided, the default is None.

Example

DEFAULT_TIMEOUT = 30

@property
@config(default_value=DEFAULT_TIMEOUT)
def timeout(self) -> float:
	"""
	Timeout in seconds when making API calls.
	"""
	return self._timeout

@timeout.setter
def timeout(self, timeout: float):
	"""
	Sets the timeout value in seconds.
	"""
	if timeout <= 0:
		raise ValueError("timeout must be positive")
	self._timeout = timeout

Last updated 1 month ago

Was this helpful?