itd-sdk 2.4.1__tar.gz → 2.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/PKG-INFO +1 -1
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/base.py +4 -2
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/client.py +1 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/file.py +5 -7
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/report.py +1 -4
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/user.py +4 -7
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/pyproject.toml +58 -58
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/README.md +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/__init__.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/_default.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/__init__.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/auth.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/comments.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/dwell.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/etc.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/files.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/hashtags.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/notifications.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/pins.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/platform.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/polls.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/posts.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/reports.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/search.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/sessions.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/subscription.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/users.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/api/verification.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/clan.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/comment.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/enums.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/exceptions.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/hashtag.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/logger.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/notification.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/pin.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/poll.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/post.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/request.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/session.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/span.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/utils.py +0 -0
- {itd_sdk-2.4.1 → itd_sdk-2.4.2}/itd/version.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import Any, Callable, TYPE_CHECKING, Iterator, TypeVar, overload
|
|
2
|
+
from typing import Any, Callable, TYPE_CHECKING, Iterator, TypeVar, overload, Literal
|
|
3
3
|
from functools import wraps
|
|
4
4
|
from time import sleep
|
|
5
5
|
from datetime import datetime, timedelta
|
|
@@ -66,9 +66,11 @@ class ITDBaseModel:
|
|
|
66
66
|
def client(self) -> Client:
|
|
67
67
|
return self._client
|
|
68
68
|
|
|
69
|
-
def _refresh(self, *, client: Client) -> dict:
|
|
69
|
+
def _refresh(self, *, client: Client) -> dict: raise NotImplementedError()
|
|
70
70
|
|
|
71
71
|
def refresh(self, *, client: Client | None = None) -> Any:
|
|
72
|
+
if not self._refreshable:
|
|
73
|
+
l.warning(f'{self.__class__.__name__} is not refreshable but refresh is called')
|
|
72
74
|
self.load_status = LoadStatus.LOADING
|
|
73
75
|
self._fill_from_data(self._refresh(client=client or self.client))
|
|
74
76
|
self.load_status = LoadStatus.FULL
|
|
@@ -30,7 +30,7 @@ class File(ITDBaseModel):
|
|
|
30
30
|
super().__init__(client)
|
|
31
31
|
self.filename = name
|
|
32
32
|
self.data = data
|
|
33
|
-
self.
|
|
33
|
+
self._fill_from_data(upload_file(client or self.client, self.filename, self.data).json())
|
|
34
34
|
|
|
35
35
|
@classmethod
|
|
36
36
|
def from_path(cls, path: Path | str, *, client: Client | None = None):
|
|
@@ -51,15 +51,12 @@ class File(ITDBaseModel):
|
|
|
51
51
|
|
|
52
52
|
return cls(name, data, client)
|
|
53
53
|
|
|
54
|
-
def _refresh(self, *, client: Client):
|
|
55
|
-
return upload_file(client, self.filename, self.data).json()
|
|
56
|
-
|
|
57
54
|
def delete(self, *, client: Client | None = None) -> None:
|
|
58
55
|
delete_file(client or self.client, self.id)
|
|
59
56
|
|
|
60
57
|
def download(self, name: str | None = None) -> None:
|
|
61
58
|
with open(name or self.filename, 'wb') as fl:
|
|
62
|
-
fl.write(get(self.url, timeout=self.client.config.
|
|
59
|
+
fl.write(get(self.url, timeout=self.client.config.timeout_file_download).content)
|
|
63
60
|
|
|
64
61
|
def __str__(self) -> str:
|
|
65
62
|
return self.filename
|
|
@@ -73,6 +70,7 @@ class _FileValidate(BaseModel, File):
|
|
|
73
70
|
class PostAttach(ITDBaseModel):
|
|
74
71
|
_validator = lambda _: _PostAttachValidate
|
|
75
72
|
_post: Post
|
|
73
|
+
_refreshable = False
|
|
76
74
|
|
|
77
75
|
id: UUID
|
|
78
76
|
type: AttachType = AttachType.IMAGE
|
|
@@ -94,7 +92,7 @@ class PostAttach(ITDBaseModel):
|
|
|
94
92
|
name (str): Имя файла.
|
|
95
93
|
"""
|
|
96
94
|
with open(name, 'wb') as fl:
|
|
97
|
-
fl.write(get(self.url, timeout=self.client.config.
|
|
95
|
+
fl.write(get(self.url, timeout=self.client.config.timeout_file_download).content)
|
|
98
96
|
|
|
99
97
|
def record_open(self, client: Client | None = None):
|
|
100
98
|
"""Записать событие открытия фото
|
|
@@ -163,7 +161,7 @@ class CommentAttach(PostAttach):
|
|
|
163
161
|
name (str | None, optional): Имя файла. None - имя, под которым был загружен этот файл. Defaults to None.
|
|
164
162
|
"""
|
|
165
163
|
with open(name or self.filename, 'wb') as fl:
|
|
166
|
-
fl.write(get(self.url, timeout=self.client.config.
|
|
164
|
+
fl.write(get(self.url, timeout=self.client.config.timeout_file_download).content)
|
|
167
165
|
|
|
168
166
|
|
|
169
167
|
class _CommentAttachValidate(BaseModel, CommentAttach):
|
|
@@ -26,10 +26,7 @@ class Report(ITDBaseModel):
|
|
|
26
26
|
self.reason = reason
|
|
27
27
|
self.description = description
|
|
28
28
|
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
def _refresh(self, *, client: Client):
|
|
32
|
-
return report(client or self.client, self.target_id, self.target_type, self.reason, self.description).json()['data']
|
|
29
|
+
self._fill_from_data(report(client or self.client, self.target_id, self.target_type, self.reason, self.description).json()['data'])
|
|
33
30
|
|
|
34
31
|
|
|
35
32
|
|
|
@@ -123,6 +123,7 @@ class _PrivacyValidate(BaseModel, Privacy):
|
|
|
123
123
|
class Subscription(ITDBaseModel):
|
|
124
124
|
_validator = lambda _: _SubscriptionValidate
|
|
125
125
|
_payment_methods: list
|
|
126
|
+
_refreshable = False
|
|
126
127
|
|
|
127
128
|
active: bool = Field(False, alias='isActive')
|
|
128
129
|
expires_at: datetime | None = Field(None, alias='expiresAt')
|
|
@@ -536,13 +537,9 @@ class Me(_UserBase):
|
|
|
536
537
|
raise exc
|
|
537
538
|
return user
|
|
538
539
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
if name == 'pin' and value is not None and getattr(value, '_user', None) is None:
|
|
543
|
-
value._user = self
|
|
544
|
-
return value
|
|
545
|
-
|
|
540
|
+
def _post_refresh(self):
|
|
541
|
+
if self.pin:
|
|
542
|
+
self.pin._user = self
|
|
546
543
|
|
|
547
544
|
|
|
548
545
|
class _MeValidate(BaseModel, Me):
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["uv_build~=0.11"]
|
|
3
|
-
build-backend = "uv_build"
|
|
4
|
-
|
|
5
|
-
[tool.uv.build-backend]
|
|
6
|
-
module-name = 'itd'
|
|
7
|
-
module-root = ''
|
|
8
|
-
|
|
9
|
-
[tool.commitizen]
|
|
10
|
-
name = "cz_conventional_commits"
|
|
11
|
-
tag_format = "v$version"
|
|
12
|
-
version_scheme = "semver2"
|
|
13
|
-
version_provider = "uv"
|
|
14
|
-
|
|
15
|
-
[project]
|
|
16
|
-
name = "itd-sdk"
|
|
17
|
-
version = "2.4.
|
|
18
|
-
description = "ITD client for python"
|
|
19
|
-
readme = "README.md"
|
|
20
|
-
authors = [
|
|
21
|
-
{ name = "firedotguy", email = "nta16022013@gmail.com" }
|
|
22
|
-
]
|
|
23
|
-
classifiers = [
|
|
24
|
-
'Development Status :: 5 - Production/Stable',
|
|
25
|
-
'Natural Language :: Russian',
|
|
26
|
-
'Programming Language :: Python',
|
|
27
|
-
'Programming Language :: Python :: 3',
|
|
28
|
-
'Framework :: Pydantic :: 2'
|
|
29
|
-
]
|
|
30
|
-
keywords = ['itd', 'itdsocial']
|
|
31
|
-
license = "MIT"
|
|
32
|
-
dependencies = [
|
|
33
|
-
"requests~=2.32.5",
|
|
34
|
-
"pydantic>=2.12.5,<2.14.0",
|
|
35
|
-
"sseclient-py~=1.9.0",
|
|
36
|
-
]
|
|
37
|
-
requires-python = ">=3.9"
|
|
38
|
-
|
|
39
|
-
[project.urls]
|
|
40
|
-
Homepage = 'https://itdsdk.qzz.io'
|
|
41
|
-
Documentation = 'https://itdsdk.qzz.io/docs'
|
|
42
|
-
|
|
43
|
-
[project.optional-dependencies]
|
|
44
|
-
filetype = [
|
|
45
|
-
"filetype>=1.2.0",
|
|
46
|
-
]
|
|
47
|
-
logs = [
|
|
48
|
-
"rich>=15.0.0",
|
|
49
|
-
]
|
|
50
|
-
date = [
|
|
51
|
-
"dateparser>=1.2.2",
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
[dependency-groups]
|
|
55
|
-
dev = [
|
|
56
|
-
"pytest>=8.4.2",
|
|
57
|
-
"python-dotenv>=1.2.1",
|
|
58
|
-
]
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build~=0.11"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[tool.uv.build-backend]
|
|
6
|
+
module-name = 'itd'
|
|
7
|
+
module-root = ''
|
|
8
|
+
|
|
9
|
+
[tool.commitizen]
|
|
10
|
+
name = "cz_conventional_commits"
|
|
11
|
+
tag_format = "v$version"
|
|
12
|
+
version_scheme = "semver2"
|
|
13
|
+
version_provider = "uv"
|
|
14
|
+
|
|
15
|
+
[project]
|
|
16
|
+
name = "itd-sdk"
|
|
17
|
+
version = "2.4.2"
|
|
18
|
+
description = "ITD client for python"
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
authors = [
|
|
21
|
+
{ name = "firedotguy", email = "nta16022013@gmail.com" }
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
'Development Status :: 5 - Production/Stable',
|
|
25
|
+
'Natural Language :: Russian',
|
|
26
|
+
'Programming Language :: Python',
|
|
27
|
+
'Programming Language :: Python :: 3',
|
|
28
|
+
'Framework :: Pydantic :: 2'
|
|
29
|
+
]
|
|
30
|
+
keywords = ['itd', 'itdsocial']
|
|
31
|
+
license = "MIT"
|
|
32
|
+
dependencies = [
|
|
33
|
+
"requests~=2.32.5",
|
|
34
|
+
"pydantic>=2.12.5,<2.14.0",
|
|
35
|
+
"sseclient-py~=1.9.0",
|
|
36
|
+
]
|
|
37
|
+
requires-python = ">=3.9"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = 'https://itdsdk.qzz.io'
|
|
41
|
+
Documentation = 'https://itdsdk.qzz.io/docs'
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
filetype = [
|
|
45
|
+
"filetype>=1.2.0",
|
|
46
|
+
]
|
|
47
|
+
logs = [
|
|
48
|
+
"rich>=15.0.0",
|
|
49
|
+
]
|
|
50
|
+
date = [
|
|
51
|
+
"dateparser>=1.2.2",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[dependency-groups]
|
|
55
|
+
dev = [
|
|
56
|
+
"pytest>=8.4.2",
|
|
57
|
+
"python-dotenv>=1.2.1",
|
|
58
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|