Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/api.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 11:21 +0000

1import os 1a

2from typing import ClassVar, Optional 1a

3 

4from pydantic import Field, SecretStr 1a

5from pydantic_settings import SettingsConfigDict 1a

6 

7from prefect.settings.base import ( 1a

8 PrefectBaseSettings, 

9 build_settings_config, 

10) 

11 

12 

13class APISettings(PrefectBaseSettings): 1a

14 """ 

15 Settings for interacting with the Prefect API 

16 """ 

17 

18 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("api",)) 1a

19 url: Optional[str] = Field( 1a

20 default=None, 

21 description="The URL of the Prefect API. If not set, the client will attempt to infer it.", 

22 ) 

23 auth_string: Optional[SecretStr] = Field( 1a

24 default=None, 

25 description="The auth string used for basic authentication with a self-hosted Prefect API. Should be kept secret.", 

26 ) 

27 key: Optional[SecretStr] = Field( 1a

28 default=None, 

29 description="The API key used for authentication with the Prefect API. Should be kept secret.", 

30 ) 

31 tls_insecure_skip_verify: bool = Field( 1a

32 default=False, 

33 description="If `True`, disables SSL checking to allow insecure requests. Setting to False is recommended only during development. For example, when using self-signed certificates.", 

34 ) 

35 ssl_cert_file: Optional[str] = Field( 1a

36 default=os.environ.get("SSL_CERT_FILE"), 

37 description="This configuration settings option specifies the path to an SSL certificate file.", 

38 ) 

39 enable_http2: bool = Field( 1a

40 default=False, 

41 description="If true, enable support for HTTP/2 for communicating with an API. If the API does not support HTTP/2, this will have no effect and connections will be made via HTTP/1.1.", 

42 ) 

43 request_timeout: float = Field( 1a

44 default=60.0, 

45 description="The default timeout for requests to the API", 

46 )