factory
appimage_updater.repositories.factory
¶
Repository factory for creating appropriate repository clients.
This module provides factory functions to create the correct repository client based on URL patterns and repository types.
detect_repository_type(url)
¶
Detect the repository type from a URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Repository URL |
required |
Returns:
Type | Description |
---|---|
str
|
Repository type string (e.g., 'github', 'gitlab') |
Raises:
Type | Description |
---|---|
RepositoryError
|
If repository type cannot be determined |
Source code in src/appimage_updater/repositories/factory.py
get_repository_client(url, timeout=30, user_agent=None, source_type=None, **kwargs)
¶
Create appropriate repository client based on URL and optional source type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Repository URL |
required |
timeout
|
int
|
Request timeout in seconds |
30
|
user_agent
|
str | None
|
Custom user agent string |
None
|
source_type
|
str | None
|
Explicit source type (github, direct_download, dynamic_download, direct) |
None
|
**kwargs
|
Any
|
Repository-specific configuration options |
{}
|
Returns:
Type | Description |
---|---|
RepositoryClient
|
Appropriate repository client instance |
Raises:
Type | Description |
---|---|
RepositoryError
|
If no suitable repository client is found |