Skip to content

YouConfig

Base classes

Name Children Inherits
BaseSearchProviderConfig
searchly_config.configs
Base search provider configuration.

⋔ Inheritance diagram

graph TD
  1042539029["configs.YouConfig"]
  860522681["configs.BaseSearchProviderConfig"]
  330168112["schema.Schema"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  860522681 --> 1042539029
  330168112 --> 860522681
  3879467795 --> 330168112
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseSearchProviderConfig

You.com provider configuration.

Uses the You.com API for web and news search. Supports country, language, and freshness filtering.

Source code in src/searchly_config/configs.py
class YouConfig(BaseSearchProviderConfig):
    """You.com provider configuration.

    Uses the You.com API for web and news search.
    Supports country, language, and freshness filtering.
    """

    type: Literal["you"] = Field("you", init=False)
    """You.com provider."""

    api_key: SecretStr | None = Field(default=None, title="API Key")
    """You.com API key. Defaults to YOU_API_KEY env var."""

    base_url: str = Field(default="https://api.ydc-index.io", title="Base URL")
    """Base URL for the API."""

    def is_configured(self) -> bool:
        """Check if You.com credentials are configured."""
        return self.api_key is not None or bool(os.getenv("YOU_API_KEY"))

    def get_provider(self) -> AsyncYouClient:
        """Create You.com provider instance."""
        from searchly.providers.you_provider.you import AsyncYouClient

        api_key = self.api_key.get_secret_value() if self.api_key else None
        return AsyncYouClient(api_key=api_key, base_url=self.base_url)

api_key class-attribute instance-attribute

api_key: SecretStr | None = Field(default=None, title='API Key')

You.com API key. Defaults to YOU_API_KEY env var.

base_url class-attribute instance-attribute

base_url: str = Field(default='https://api.ydc-index.io', title='Base URL')

Base URL for the API.

type class-attribute instance-attribute

type: Literal['you'] = Field('you', init=False)

You.com provider.

get_provider

get_provider() -> AsyncYouClient

Create You.com provider instance.

Source code in src/searchly_config/configs.py
def get_provider(self) -> AsyncYouClient:
    """Create You.com provider instance."""
    from searchly.providers.you_provider.you import AsyncYouClient

    api_key = self.api_key.get_secret_value() if self.api_key else None
    return AsyncYouClient(api_key=api_key, base_url=self.base_url)

is_configured

is_configured() -> bool

Check if You.com credentials are configured.

Source code in src/searchly_config/configs.py
def is_configured(self) -> bool:
    """Check if You.com credentials are configured."""
    return self.api_key is not None or bool(os.getenv("YOU_API_KEY"))

:fa-brands-github: Show source on GitHub