mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-03-04 12:55:10 +00:00
- Add pyproject.toml with uv and ruff configuration - Pin Python version to 3.13 via .python-version - Add Makefile commands: lint, format, fix - Apply ruff formatting to entire codebase - Remove unused imports (base64 in yookassa/simple_subscription) - Update .gitignore for new config files
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""
|
|
Device-related DTO models.
|
|
Based on PHP library's DTO\\DeviceInfo class.
|
|
"""
|
|
|
|
from typing import Any, ClassVar
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class DeviceInfo(BaseModel):
|
|
"""
|
|
Device information model for API requests.
|
|
Maps to PHP DTO\\DeviceInfo.
|
|
"""
|
|
|
|
# Constants from PHP class
|
|
SOURCE_TYPE_WEB: ClassVar[str] = 'WEB'
|
|
APP_VERSION: ClassVar[str] = '1.0.0'
|
|
USER_AGENT: ClassVar[str] = (
|
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 '
|
|
'(KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36'
|
|
)
|
|
|
|
source_type: str = Field(
|
|
default=SOURCE_TYPE_WEB,
|
|
alias='sourceType',
|
|
description='Source type (usually WEB)',
|
|
)
|
|
source_device_id: str = Field(..., alias='sourceDeviceId', description='Device ID')
|
|
app_version: str = Field(default=APP_VERSION, alias='appVersion', description='Application version')
|
|
user_agent: str = Field(default=USER_AGENT, description='User agent string')
|
|
|
|
def model_dump(self, **kwargs: Any) -> dict[str, Any]:
|
|
"""Custom serialization to match PHP jsonSerialize format."""
|
|
_ = kwargs
|
|
return {
|
|
'sourceType': self.source_type,
|
|
'sourceDeviceId': self.source_device_id,
|
|
'appVersion': self.app_version,
|
|
'metaDetails': {'userAgent': self.user_agent},
|
|
}
|