tikdataapi 0.1.0__py3-none-any.whl
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.
- tikdataapi/__init__.py +8 -0
- tikdataapi/api/__init__.py +1 -0
- tikdataapi/api/account/__init__.py +1 -0
- tikdataapi/api/account/get_me.py +144 -0
- tikdataapi/api/billing/__init__.py +1 -0
- tikdataapi/api/billing/create_checkout.py +215 -0
- tikdataapi/api/billing/list_packs.py +144 -0
- tikdataapi/api/hashtags/__init__.py +1 -0
- tikdataapi/api/hashtags/get_hashtag.py +220 -0
- tikdataapi/api/hashtags/get_hashtag_videos.py +250 -0
- tikdataapi/api/music/__init__.py +1 -0
- tikdataapi/api/music/get_music.py +234 -0
- tikdataapi/api/music/get_music_videos.py +254 -0
- tikdataapi/api/playlists/__init__.py +1 -0
- tikdataapi/api/playlists/get_playlist_videos.py +258 -0
- tikdataapi/api/search/__init__.py +1 -0
- tikdataapi/api/search/search_hashtags.py +261 -0
- tikdataapi/api/search/search_live.py +258 -0
- tikdataapi/api/search/search_music.py +260 -0
- tikdataapi/api/search/search_users.py +276 -0
- tikdataapi/api/search/search_videos.py +260 -0
- tikdataapi/api/users/__init__.py +1 -0
- tikdataapi/api/users/get_user.py +222 -0
- tikdataapi/api/users/get_user_followers.py +266 -0
- tikdataapi/api/users/get_user_following.py +266 -0
- tikdataapi/api/users/get_user_live.py +236 -0
- tikdataapi/api/users/get_user_playlists.py +276 -0
- tikdataapi/api/users/get_user_reposts.py +266 -0
- tikdataapi/api/users/get_user_videos.py +254 -0
- tikdataapi/api/users/get_users.py +247 -0
- tikdataapi/api/users/get_users_videos.py +259 -0
- tikdataapi/api/videos/__init__.py +1 -0
- tikdataapi/api/videos/get_comment_replies.py +260 -0
- tikdataapi/api/videos/get_comments.py +258 -0
- tikdataapi/api/videos/get_related_videos.py +247 -0
- tikdataapi/api/videos/get_trending_videos.py +238 -0
- tikdataapi/api/videos/get_video.py +218 -0
- tikdataapi/api/videos/get_video_transcript.py +247 -0
- tikdataapi/api/videos/get_videos.py +235 -0
- tikdataapi/client.py +268 -0
- tikdataapi/errors.py +16 -0
- tikdataapi/models/__init__.py +117 -0
- tikdataapi/models/batch_error.py +104 -0
- tikdataapi/models/batch_error_code.py +15 -0
- tikdataapi/models/batch_meta.py +127 -0
- tikdataapi/models/batch_meta_cache.py +11 -0
- tikdataapi/models/comment.py +163 -0
- tikdataapi/models/comment_author.py +97 -0
- tikdataapi/models/comment_page.py +130 -0
- tikdataapi/models/create_checkout_body.py +63 -0
- tikdataapi/models/create_checkout_body_pack.py +11 -0
- tikdataapi/models/create_checkout_response_200.py +97 -0
- tikdataapi/models/error.py +78 -0
- tikdataapi/models/error_body.py +107 -0
- tikdataapi/models/error_body_code.py +22 -0
- tikdataapi/models/get_me_response_200.py +88 -0
- tikdataapi/models/get_users_body.py +61 -0
- tikdataapi/models/get_users_videos_body.py +72 -0
- tikdataapi/models/get_videos_body.py +61 -0
- tikdataapi/models/hashtag.py +124 -0
- tikdataapi/models/hashtag_response.py +122 -0
- tikdataapi/models/hashtag_summary.py +98 -0
- tikdataapi/models/hashtag_summary_page.py +130 -0
- tikdataapi/models/list_packs_response_200.py +103 -0
- tikdataapi/models/list_packs_response_200_data_item.py +88 -0
- tikdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
- tikdataapi/models/live_room.py +142 -0
- tikdataapi/models/live_room_author.py +90 -0
- tikdataapi/models/live_room_page.py +130 -0
- tikdataapi/models/live_room_response.py +124 -0
- tikdataapi/models/meta.py +108 -0
- tikdataapi/models/meta_cache.py +10 -0
- tikdataapi/models/music.py +107 -0
- tikdataapi/models/music_detail.py +172 -0
- tikdataapi/models/music_response.py +124 -0
- tikdataapi/models/music_summary.py +137 -0
- tikdataapi/models/music_summary_page.py +130 -0
- tikdataapi/models/not_found_reason.py +12 -0
- tikdataapi/models/playlist.py +114 -0
- tikdataapi/models/playlist_author.py +86 -0
- tikdataapi/models/playlist_page.py +130 -0
- tikdataapi/models/problem.py +131 -0
- tikdataapi/models/transcript.py +128 -0
- tikdataapi/models/transcript_response.py +124 -0
- tikdataapi/models/transcript_segment.py +77 -0
- tikdataapi/models/user.py +207 -0
- tikdataapi/models/user_batch.py +145 -0
- tikdataapi/models/user_page.py +130 -0
- tikdataapi/models/user_response.py +126 -0
- tikdataapi/models/user_summary.py +152 -0
- tikdataapi/models/user_summary_page.py +130 -0
- tikdataapi/models/user_videos.py +96 -0
- tikdataapi/models/user_videos_batch.py +145 -0
- tikdataapi/models/video.py +297 -0
- tikdataapi/models/video_batch.py +145 -0
- tikdataapi/models/video_page.py +130 -0
- tikdataapi/models/video_response.py +122 -0
- tikdataapi/models/video_type.py +9 -0
- tikdataapi/py.typed +1 -0
- tikdataapi/types.py +54 -0
- tikdataapi-0.1.0.dist-info/METADATA +148 -0
- tikdataapi-0.1.0.dist-info/RECORD +103 -0
- tikdataapi-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="User")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class User:
|
|
17
|
+
"""An account. The counts (`followers`, `following`, `likes`, `videos`) are exact in a profile that you
|
|
18
|
+
read with `/v1/users/{user}` or `/v1/users/batch`. In the `author` of a video, TikTok sends them
|
|
19
|
+
rounded, and in an entry of a follower or following list they may be rounded: read the profile for the
|
|
20
|
+
exact counts.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
id (str): The numeric account id. It stays the same when the username changes. Example: 107955.
|
|
24
|
+
username (str): The name after the @ in the address of the profile. Example: tiktok.
|
|
25
|
+
sec_uid (str): The second, long account id of TikTok. It stays the same when the username changes. Every
|
|
26
|
+
endpoint
|
|
27
|
+
that takes a username also takes this id, and then needs no lookup of the profile.
|
|
28
|
+
Example: MS4wLjABAAAAv7iSuuXDJGDvJkmH_vz1qkDZYo1apxgzaxdBSeIuPiM.
|
|
29
|
+
nickname (str): The display name.
|
|
30
|
+
followers (int):
|
|
31
|
+
following (int):
|
|
32
|
+
likes (int): The likes on all videos of the account.
|
|
33
|
+
videos (int): The public videos of the account.
|
|
34
|
+
collected_at (datetime.datetime): When we read this profile from TikTok: UTC, whole seconds. The counts and the
|
|
35
|
+
texts are those of that
|
|
36
|
+
moment. A profile from cache (`"cache": "hit"`) keeps the time of its own read; `fresh=true`
|
|
37
|
+
gives a new read and a new time.
|
|
38
|
+
Example: 2026-12-02T08:55:12Z.
|
|
39
|
+
bio (str | Unset):
|
|
40
|
+
bio_link (str | Unset): The link on the profile, when the account has one.
|
|
41
|
+
avatar_url (str | Unset): An address on the TikTok image servers. It carries a signature and stops working after
|
|
42
|
+
some days:
|
|
43
|
+
store the image, not the address.
|
|
44
|
+
verified (bool | Unset):
|
|
45
|
+
private (bool | Unset): `true`: TikTok shows the profile, but not its videos, to a reader who does not follow
|
|
46
|
+
the account.
|
|
47
|
+
The video list of a private account is empty and costs nothing.
|
|
48
|
+
language (str | Unset): The language of the account, when TikTok sends it.
|
|
49
|
+
friends (int | Unset): Accounts that follow this account and that it follows. Absent when TikTok does not send
|
|
50
|
+
it.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
id: str
|
|
54
|
+
username: str
|
|
55
|
+
sec_uid: str
|
|
56
|
+
nickname: str
|
|
57
|
+
followers: int
|
|
58
|
+
following: int
|
|
59
|
+
likes: int
|
|
60
|
+
videos: int
|
|
61
|
+
collected_at: datetime.datetime
|
|
62
|
+
bio: str | Unset = UNSET
|
|
63
|
+
bio_link: str | Unset = UNSET
|
|
64
|
+
avatar_url: str | Unset = UNSET
|
|
65
|
+
verified: bool | Unset = UNSET
|
|
66
|
+
private: bool | Unset = UNSET
|
|
67
|
+
language: str | Unset = UNSET
|
|
68
|
+
friends: int | Unset = UNSET
|
|
69
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> dict[str, Any]:
|
|
72
|
+
id = self.id
|
|
73
|
+
|
|
74
|
+
username = self.username
|
|
75
|
+
|
|
76
|
+
sec_uid = self.sec_uid
|
|
77
|
+
|
|
78
|
+
nickname = self.nickname
|
|
79
|
+
|
|
80
|
+
followers = self.followers
|
|
81
|
+
|
|
82
|
+
following = self.following
|
|
83
|
+
|
|
84
|
+
likes = self.likes
|
|
85
|
+
|
|
86
|
+
videos = self.videos
|
|
87
|
+
|
|
88
|
+
collected_at = self.collected_at.isoformat()
|
|
89
|
+
|
|
90
|
+
bio = self.bio
|
|
91
|
+
|
|
92
|
+
bio_link = self.bio_link
|
|
93
|
+
|
|
94
|
+
avatar_url = self.avatar_url
|
|
95
|
+
|
|
96
|
+
verified = self.verified
|
|
97
|
+
|
|
98
|
+
private = self.private
|
|
99
|
+
|
|
100
|
+
language = self.language
|
|
101
|
+
|
|
102
|
+
friends = self.friends
|
|
103
|
+
|
|
104
|
+
field_dict: dict[str, Any] = {}
|
|
105
|
+
field_dict.update(self.additional_properties)
|
|
106
|
+
field_dict.update(
|
|
107
|
+
{
|
|
108
|
+
"id": id,
|
|
109
|
+
"username": username,
|
|
110
|
+
"sec_uid": sec_uid,
|
|
111
|
+
"nickname": nickname,
|
|
112
|
+
"followers": followers,
|
|
113
|
+
"following": following,
|
|
114
|
+
"likes": likes,
|
|
115
|
+
"videos": videos,
|
|
116
|
+
"collected_at": collected_at,
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
if bio is not UNSET:
|
|
120
|
+
field_dict["bio"] = bio
|
|
121
|
+
if bio_link is not UNSET:
|
|
122
|
+
field_dict["bio_link"] = bio_link
|
|
123
|
+
if avatar_url is not UNSET:
|
|
124
|
+
field_dict["avatar_url"] = avatar_url
|
|
125
|
+
if verified is not UNSET:
|
|
126
|
+
field_dict["verified"] = verified
|
|
127
|
+
if private is not UNSET:
|
|
128
|
+
field_dict["private"] = private
|
|
129
|
+
if language is not UNSET:
|
|
130
|
+
field_dict["language"] = language
|
|
131
|
+
if friends is not UNSET:
|
|
132
|
+
field_dict["friends"] = friends
|
|
133
|
+
|
|
134
|
+
return field_dict
|
|
135
|
+
|
|
136
|
+
@classmethod
|
|
137
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
138
|
+
d = dict(src_dict)
|
|
139
|
+
id = d.pop("id")
|
|
140
|
+
|
|
141
|
+
username = d.pop("username")
|
|
142
|
+
|
|
143
|
+
sec_uid = d.pop("sec_uid")
|
|
144
|
+
|
|
145
|
+
nickname = d.pop("nickname")
|
|
146
|
+
|
|
147
|
+
followers = d.pop("followers")
|
|
148
|
+
|
|
149
|
+
following = d.pop("following")
|
|
150
|
+
|
|
151
|
+
likes = d.pop("likes")
|
|
152
|
+
|
|
153
|
+
videos = d.pop("videos")
|
|
154
|
+
|
|
155
|
+
collected_at = datetime.datetime.fromisoformat(d.pop("collected_at"))
|
|
156
|
+
|
|
157
|
+
bio = d.pop("bio", UNSET)
|
|
158
|
+
|
|
159
|
+
bio_link = d.pop("bio_link", UNSET)
|
|
160
|
+
|
|
161
|
+
avatar_url = d.pop("avatar_url", UNSET)
|
|
162
|
+
|
|
163
|
+
verified = d.pop("verified", UNSET)
|
|
164
|
+
|
|
165
|
+
private = d.pop("private", UNSET)
|
|
166
|
+
|
|
167
|
+
language = d.pop("language", UNSET)
|
|
168
|
+
|
|
169
|
+
friends = d.pop("friends", UNSET)
|
|
170
|
+
|
|
171
|
+
user = cls(
|
|
172
|
+
id=id,
|
|
173
|
+
username=username,
|
|
174
|
+
sec_uid=sec_uid,
|
|
175
|
+
nickname=nickname,
|
|
176
|
+
followers=followers,
|
|
177
|
+
following=following,
|
|
178
|
+
likes=likes,
|
|
179
|
+
videos=videos,
|
|
180
|
+
collected_at=collected_at,
|
|
181
|
+
bio=bio,
|
|
182
|
+
bio_link=bio_link,
|
|
183
|
+
avatar_url=avatar_url,
|
|
184
|
+
verified=verified,
|
|
185
|
+
private=private,
|
|
186
|
+
language=language,
|
|
187
|
+
friends=friends,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
user.additional_properties = d
|
|
191
|
+
return user
|
|
192
|
+
|
|
193
|
+
@property
|
|
194
|
+
def additional_keys(self) -> list[str]:
|
|
195
|
+
return list(self.additional_properties.keys())
|
|
196
|
+
|
|
197
|
+
def __getitem__(self, key: str) -> Any:
|
|
198
|
+
return self.additional_properties[key]
|
|
199
|
+
|
|
200
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
201
|
+
self.additional_properties[key] = value
|
|
202
|
+
|
|
203
|
+
def __delitem__(self, key: str) -> None:
|
|
204
|
+
del self.additional_properties[key]
|
|
205
|
+
|
|
206
|
+
def __contains__(self, key: str) -> bool:
|
|
207
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.batch_meta_cache import BatchMetaCache
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ..models.batch_error import BatchError
|
|
14
|
+
from ..models.user import User
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="UserBatch")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class UserBatch:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
errors (list[BatchError]): Inputs that returned nothing, with the reason. Never charged.
|
|
25
|
+
items (int): Objects returned. In the video lists batch: videos returned, for all accounts together.
|
|
26
|
+
credits_charged (float):
|
|
27
|
+
balance_remaining (float):
|
|
28
|
+
cache (BatchMetaCache): The mode of the found items when they all agree, else `mixed`.
|
|
29
|
+
cache_hits (int): Objects served from cache, at half price. In the video lists batch: accounts served from
|
|
30
|
+
cache.
|
|
31
|
+
request_id (UUID):
|
|
32
|
+
data (list[User]): Found profiles, in input order.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
errors: list[BatchError]
|
|
36
|
+
items: int
|
|
37
|
+
credits_charged: float
|
|
38
|
+
balance_remaining: float
|
|
39
|
+
cache: BatchMetaCache
|
|
40
|
+
cache_hits: int
|
|
41
|
+
request_id: UUID
|
|
42
|
+
data: list[User]
|
|
43
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
44
|
+
|
|
45
|
+
def to_dict(self) -> dict[str, Any]:
|
|
46
|
+
errors = []
|
|
47
|
+
for errors_item_data in self.errors:
|
|
48
|
+
errors_item = errors_item_data.to_dict()
|
|
49
|
+
errors.append(errors_item)
|
|
50
|
+
|
|
51
|
+
items = self.items
|
|
52
|
+
|
|
53
|
+
credits_charged = self.credits_charged
|
|
54
|
+
|
|
55
|
+
balance_remaining = self.balance_remaining
|
|
56
|
+
|
|
57
|
+
cache = self.cache.value
|
|
58
|
+
|
|
59
|
+
cache_hits = self.cache_hits
|
|
60
|
+
|
|
61
|
+
request_id = str(self.request_id)
|
|
62
|
+
|
|
63
|
+
data = []
|
|
64
|
+
for data_item_data in self.data:
|
|
65
|
+
data_item = data_item_data.to_dict()
|
|
66
|
+
data.append(data_item)
|
|
67
|
+
|
|
68
|
+
field_dict: dict[str, Any] = {}
|
|
69
|
+
field_dict.update(self.additional_properties)
|
|
70
|
+
field_dict.update(
|
|
71
|
+
{
|
|
72
|
+
"errors": errors,
|
|
73
|
+
"items": items,
|
|
74
|
+
"credits_charged": credits_charged,
|
|
75
|
+
"balance_remaining": balance_remaining,
|
|
76
|
+
"cache": cache,
|
|
77
|
+
"cache_hits": cache_hits,
|
|
78
|
+
"request_id": request_id,
|
|
79
|
+
"data": data,
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return field_dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
87
|
+
from ..models.batch_error import BatchError # noqa: PLC0415
|
|
88
|
+
from ..models.user import User # noqa: PLC0415
|
|
89
|
+
|
|
90
|
+
d = dict(src_dict)
|
|
91
|
+
errors = []
|
|
92
|
+
_errors = d.pop("errors")
|
|
93
|
+
for errors_item_data in _errors:
|
|
94
|
+
errors_item = BatchError.from_dict(errors_item_data)
|
|
95
|
+
|
|
96
|
+
errors.append(errors_item)
|
|
97
|
+
|
|
98
|
+
items = d.pop("items")
|
|
99
|
+
|
|
100
|
+
credits_charged = d.pop("credits_charged")
|
|
101
|
+
|
|
102
|
+
balance_remaining = d.pop("balance_remaining")
|
|
103
|
+
|
|
104
|
+
cache = BatchMetaCache(d.pop("cache"))
|
|
105
|
+
|
|
106
|
+
cache_hits = d.pop("cache_hits")
|
|
107
|
+
|
|
108
|
+
request_id = UUID(d.pop("request_id"))
|
|
109
|
+
|
|
110
|
+
data = []
|
|
111
|
+
_data = d.pop("data")
|
|
112
|
+
for data_item_data in _data:
|
|
113
|
+
data_item = User.from_dict(data_item_data)
|
|
114
|
+
|
|
115
|
+
data.append(data_item)
|
|
116
|
+
|
|
117
|
+
user_batch = cls(
|
|
118
|
+
errors=errors,
|
|
119
|
+
items=items,
|
|
120
|
+
credits_charged=credits_charged,
|
|
121
|
+
balance_remaining=balance_remaining,
|
|
122
|
+
cache=cache,
|
|
123
|
+
cache_hits=cache_hits,
|
|
124
|
+
request_id=request_id,
|
|
125
|
+
data=data,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
user_batch.additional_properties = d
|
|
129
|
+
return user_batch
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def additional_keys(self) -> list[str]:
|
|
133
|
+
return list(self.additional_properties.keys())
|
|
134
|
+
|
|
135
|
+
def __getitem__(self, key: str) -> Any:
|
|
136
|
+
return self.additional_properties[key]
|
|
137
|
+
|
|
138
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
139
|
+
self.additional_properties[key] = value
|
|
140
|
+
|
|
141
|
+
def __delitem__(self, key: str) -> None:
|
|
142
|
+
del self.additional_properties[key]
|
|
143
|
+
|
|
144
|
+
def __contains__(self, key: str) -> bool:
|
|
145
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.meta_cache import MetaCache
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.user import User
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="UserPage")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class UserPage:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
items (int): Objects returned.
|
|
25
|
+
credits_charged (float): Example: 16.
|
|
26
|
+
balance_remaining (float): Example: 79984.
|
|
27
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
28
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
29
|
+
price of its own source; `hit` means all of it came from cache.
|
|
30
|
+
request_id (UUID):
|
|
31
|
+
data (list[User]):
|
|
32
|
+
next_cursor (str | Unset):
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
items: int
|
|
36
|
+
credits_charged: float
|
|
37
|
+
balance_remaining: float
|
|
38
|
+
cache: MetaCache
|
|
39
|
+
request_id: UUID
|
|
40
|
+
data: list[User]
|
|
41
|
+
next_cursor: str | Unset = UNSET
|
|
42
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
43
|
+
|
|
44
|
+
def to_dict(self) -> dict[str, Any]:
|
|
45
|
+
items = self.items
|
|
46
|
+
|
|
47
|
+
credits_charged = self.credits_charged
|
|
48
|
+
|
|
49
|
+
balance_remaining = self.balance_remaining
|
|
50
|
+
|
|
51
|
+
cache = self.cache.value
|
|
52
|
+
|
|
53
|
+
request_id = str(self.request_id)
|
|
54
|
+
|
|
55
|
+
data = []
|
|
56
|
+
for data_item_data in self.data:
|
|
57
|
+
data_item = data_item_data.to_dict()
|
|
58
|
+
data.append(data_item)
|
|
59
|
+
|
|
60
|
+
next_cursor = self.next_cursor
|
|
61
|
+
|
|
62
|
+
field_dict: dict[str, Any] = {}
|
|
63
|
+
field_dict.update(self.additional_properties)
|
|
64
|
+
field_dict.update(
|
|
65
|
+
{
|
|
66
|
+
"items": items,
|
|
67
|
+
"credits_charged": credits_charged,
|
|
68
|
+
"balance_remaining": balance_remaining,
|
|
69
|
+
"cache": cache,
|
|
70
|
+
"request_id": request_id,
|
|
71
|
+
"data": data,
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
if next_cursor is not UNSET:
|
|
75
|
+
field_dict["next_cursor"] = next_cursor
|
|
76
|
+
|
|
77
|
+
return field_dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
81
|
+
from ..models.user import User # noqa: PLC0415
|
|
82
|
+
|
|
83
|
+
d = dict(src_dict)
|
|
84
|
+
items = d.pop("items")
|
|
85
|
+
|
|
86
|
+
credits_charged = d.pop("credits_charged")
|
|
87
|
+
|
|
88
|
+
balance_remaining = d.pop("balance_remaining")
|
|
89
|
+
|
|
90
|
+
cache = MetaCache(d.pop("cache"))
|
|
91
|
+
|
|
92
|
+
request_id = UUID(d.pop("request_id"))
|
|
93
|
+
|
|
94
|
+
data = []
|
|
95
|
+
_data = d.pop("data")
|
|
96
|
+
for data_item_data in _data:
|
|
97
|
+
data_item = User.from_dict(data_item_data)
|
|
98
|
+
|
|
99
|
+
data.append(data_item)
|
|
100
|
+
|
|
101
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
102
|
+
|
|
103
|
+
user_page = cls(
|
|
104
|
+
items=items,
|
|
105
|
+
credits_charged=credits_charged,
|
|
106
|
+
balance_remaining=balance_remaining,
|
|
107
|
+
cache=cache,
|
|
108
|
+
request_id=request_id,
|
|
109
|
+
data=data,
|
|
110
|
+
next_cursor=next_cursor,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
user_page.additional_properties = d
|
|
114
|
+
return user_page
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def additional_keys(self) -> list[str]:
|
|
118
|
+
return list(self.additional_properties.keys())
|
|
119
|
+
|
|
120
|
+
def __getitem__(self, key: str) -> Any:
|
|
121
|
+
return self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
124
|
+
self.additional_properties[key] = value
|
|
125
|
+
|
|
126
|
+
def __delitem__(self, key: str) -> None:
|
|
127
|
+
del self.additional_properties[key]
|
|
128
|
+
|
|
129
|
+
def __contains__(self, key: str) -> bool:
|
|
130
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.meta_cache import MetaCache
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.user import User
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="UserResponse")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class UserResponse:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
items (int): Objects returned.
|
|
25
|
+
credits_charged (float): Example: 16.
|
|
26
|
+
balance_remaining (float): Example: 79984.
|
|
27
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
28
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
29
|
+
price of its own source; `hit` means all of it came from cache.
|
|
30
|
+
request_id (UUID):
|
|
31
|
+
data (User): An account. The counts (`followers`, `following`, `likes`, `videos`) are exact in a profile that
|
|
32
|
+
you
|
|
33
|
+
read with `/v1/users/{user}` or `/v1/users/batch`. In the `author` of a video, TikTok sends them
|
|
34
|
+
rounded, and in an entry of a follower or following list they may be rounded: read the profile for the
|
|
35
|
+
exact counts.
|
|
36
|
+
next_cursor (str | Unset):
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
items: int
|
|
40
|
+
credits_charged: float
|
|
41
|
+
balance_remaining: float
|
|
42
|
+
cache: MetaCache
|
|
43
|
+
request_id: UUID
|
|
44
|
+
data: User
|
|
45
|
+
next_cursor: str | Unset = UNSET
|
|
46
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
47
|
+
|
|
48
|
+
def to_dict(self) -> dict[str, Any]:
|
|
49
|
+
items = self.items
|
|
50
|
+
|
|
51
|
+
credits_charged = self.credits_charged
|
|
52
|
+
|
|
53
|
+
balance_remaining = self.balance_remaining
|
|
54
|
+
|
|
55
|
+
cache = self.cache.value
|
|
56
|
+
|
|
57
|
+
request_id = str(self.request_id)
|
|
58
|
+
|
|
59
|
+
data = self.data.to_dict()
|
|
60
|
+
|
|
61
|
+
next_cursor = self.next_cursor
|
|
62
|
+
|
|
63
|
+
field_dict: dict[str, Any] = {}
|
|
64
|
+
field_dict.update(self.additional_properties)
|
|
65
|
+
field_dict.update(
|
|
66
|
+
{
|
|
67
|
+
"items": items,
|
|
68
|
+
"credits_charged": credits_charged,
|
|
69
|
+
"balance_remaining": balance_remaining,
|
|
70
|
+
"cache": cache,
|
|
71
|
+
"request_id": request_id,
|
|
72
|
+
"data": data,
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
if next_cursor is not UNSET:
|
|
76
|
+
field_dict["next_cursor"] = next_cursor
|
|
77
|
+
|
|
78
|
+
return field_dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
82
|
+
from ..models.user import User # noqa: PLC0415
|
|
83
|
+
|
|
84
|
+
d = dict(src_dict)
|
|
85
|
+
items = d.pop("items")
|
|
86
|
+
|
|
87
|
+
credits_charged = d.pop("credits_charged")
|
|
88
|
+
|
|
89
|
+
balance_remaining = d.pop("balance_remaining")
|
|
90
|
+
|
|
91
|
+
cache = MetaCache(d.pop("cache"))
|
|
92
|
+
|
|
93
|
+
request_id = UUID(d.pop("request_id"))
|
|
94
|
+
|
|
95
|
+
data = User.from_dict(d.pop("data"))
|
|
96
|
+
|
|
97
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
98
|
+
|
|
99
|
+
user_response = cls(
|
|
100
|
+
items=items,
|
|
101
|
+
credits_charged=credits_charged,
|
|
102
|
+
balance_remaining=balance_remaining,
|
|
103
|
+
cache=cache,
|
|
104
|
+
request_id=request_id,
|
|
105
|
+
data=data,
|
|
106
|
+
next_cursor=next_cursor,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
user_response.additional_properties = d
|
|
110
|
+
return user_response
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def additional_keys(self) -> list[str]:
|
|
114
|
+
return list(self.additional_properties.keys())
|
|
115
|
+
|
|
116
|
+
def __getitem__(self, key: str) -> Any:
|
|
117
|
+
return self.additional_properties[key]
|
|
118
|
+
|
|
119
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
120
|
+
self.additional_properties[key] = value
|
|
121
|
+
|
|
122
|
+
def __delitem__(self, key: str) -> None:
|
|
123
|
+
del self.additional_properties[key]
|
|
124
|
+
|
|
125
|
+
def __contains__(self, key: str) -> bool:
|
|
126
|
+
return key in self.additional_properties
|