MCPcopy Create free account
hub / github.com/apify/crawlee-python / Configuration

Class Configuration

src/crawlee/configuration.py:20–230  ·  view source on GitHub ↗

Configuration settings for the Crawlee project. This class stores common configurable parameters for Crawlee. Default values are provided for all settings, so typically, no adjustments are necessary. However, you may modify settings for specific use cases, such as changing the default s

Source from the content-addressed store, hash-verified

18
19@docs_group('Configuration')
20class Configuration(BaseSettings):
21 """Configuration settings for the Crawlee project.
22
23 This class stores common configurable parameters for Crawlee. Default values are provided for all settings,
24 so typically, no adjustments are necessary. However, you may modify settings for specific use cases,
25 such as changing the default storage directory, the default storage IDs, the timeout for internal
26 operations, and more.
27
28 Settings can also be configured via environment variables, prefixed with `CRAWLEE_`.
29 """
30
31 # TODO: https://github.com/pydantic/pydantic-settings/issues/706
32 # Use `SettingsConfigDict(validate_by_name=True, validate_by_alias=True)` when issue is resolved.
33 model_config = SettingsConfigDict(populate_by_name=True)
34
35 internal_timeout: Annotated[timedelta | None, Field(alias='crawlee_internal_timeout')] = None
36 """Timeout for the internal asynchronous operations."""
37
38 default_browser_path: Annotated[
39 str | None,
40 Field(
41 validation_alias=AliasChoices(
42 'apify_default_browser_path',
43 'crawlee_default_browser_path',
44 )
45 ),
46 ] = None
47 """Specifies the path to the browser executable. Currently primarily for Playwright-based features. This option
48 is passed directly to Playwright's `browser_type.launch` method as `executable_path` argument. For more details,
49 refer to the Playwright documentation:
50 https://playwright.dev/docs/api/class-browsertype#browser-type-launch.
51 """
52
53 disable_browser_sandbox: Annotated[
54 bool,
55 Field(
56 validation_alias=AliasChoices(
57 'apify_disable_browser_sandbox',
58 'crawlee_disable_browser_sandbox',
59 )
60 ),
61 ] = False
62 """Disables the sandbox for the browser. Currently primarily for Playwright-based features. This option
63 is passed directly to Playwright's `browser_type.launch` method as `chromium_sandbox`. For more details,
64 refer to the Playwright documentation:
65 https://playwright.dev/docs/api/class-browsertype#browser-type-launch."""
66
67 log_level: Annotated[
68 LogLevel,
69 Field(
70 validation_alias=AliasChoices(
71 'apify_log_level',
72 'crawlee_log_level',
73 )
74 ),
75 BeforeValidator(lambda value: str(value).upper()),
76 ] = 'INFO'
77 """The logging level."""

Calls

no outgoing calls