itd-sdk 2.4.3__tar.gz → 2.5.0__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.
Files changed (46) hide show
  1. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/PKG-INFO +112 -109
  2. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/README.md +105 -104
  3. itd_sdk-2.5.0/itd/__init__.py +65 -0
  4. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/_default.py +19 -17
  5. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/__init__.py +0 -0
  6. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/auth.py +45 -35
  7. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/comments.py +67 -44
  8. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/dwell.py +20 -19
  9. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/etc.py +19 -16
  10. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/files.py +22 -20
  11. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/hashtags.py +29 -19
  12. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/notifications.py +43 -39
  13. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/pins.py +26 -22
  14. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/platform.py +19 -17
  15. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/polls.py +17 -16
  16. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/posts.py +149 -112
  17. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/reports.py +20 -17
  18. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/search.py +14 -13
  19. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/sessions.py +26 -23
  20. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/subscription.py +50 -42
  21. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/users.py +146 -106
  22. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/api/verification.py +20 -17
  23. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/base.py +435 -414
  24. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/clan.py +38 -38
  25. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/client.py +433 -372
  26. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/comment.py +252 -265
  27. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/enums.py +224 -188
  28. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/exceptions.py +353 -290
  29. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/file.py +173 -168
  30. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/hashtag.py +84 -73
  31. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/logger.py +50 -52
  32. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/notification.py +209 -212
  33. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/pin.py +49 -48
  34. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/poll.py +150 -150
  35. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/post.py +844 -801
  36. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/report.py +39 -34
  37. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/request.py +136 -139
  38. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/session.py +93 -91
  39. itd_sdk-2.5.0/itd/span.py +22 -0
  40. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/user.py +662 -606
  41. itd_sdk-2.5.0/itd/utils.py +128 -0
  42. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/itd/version.py +75 -73
  43. {itd_sdk-2.4.3 → itd_sdk-2.5.0}/pyproject.toml +68 -58
  44. itd_sdk-2.4.3/itd/__init__.py +0 -14
  45. itd_sdk-2.4.3/itd/span.py +0 -10
  46. itd_sdk-2.4.3/itd/utils.py +0 -219
@@ -1,23 +1,25 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itd-sdk
3
- Version: 2.4.3
3
+ Version: 2.5.0
4
4
  Summary: ITD client for python
5
5
  Keywords: itd,itdsocial
6
- Author: firedotguy
7
- Author-email: firedotguy <nta16022013@gmail.com>
6
+ Author: fi-res
7
+ Author-email: fi-res <nta16022013@gmail.com>
8
8
  License-Expression: MIT
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Natural Language :: Russian
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Framework :: Pydantic :: 2
14
- Requires-Dist: requests~=2.32.5
14
+ Requires-Dist: requests>=2.32.5,<2.35.0
15
15
  Requires-Dist: pydantic>=2.12.5,<2.14.0
16
16
  Requires-Dist: sseclient-py~=1.9.0
17
+ Requires-Dist: telegramify-markdown>=0.5.4
18
+ Requires-Dist: lxml>=6.1.1
17
19
  Requires-Dist: dateparser>=1.2.2 ; extra == 'date'
18
20
  Requires-Dist: filetype>=1.2.0 ; extra == 'filetype'
19
21
  Requires-Dist: rich>=15.0.0 ; extra == 'logs'
20
- Requires-Python: >=3.9
22
+ Requires-Python: >=3.10
21
23
  Project-URL: Homepage, https://itdsdk.qzz.io
22
24
  Project-URL: Documentation, https://itdsdk.qzz.io/docs
23
25
  Provides-Extra: date
@@ -25,107 +27,108 @@ Provides-Extra: filetype
25
27
  Provides-Extra: logs
26
28
  Description-Content-Type: text/markdown
27
29
 
28
- # itd-sdk
29
- Клиент ITD для python
30
- Документация (beta): https://itdsdk.qzz.io/docs
31
-
32
- ## Установка
33
-
34
- ```bash
35
- pip install itd-sdk
36
- ```
37
-
38
- ## Пример
39
-
40
- ```python
41
- from itd import ITDClient, Me
42
-
43
- c = ITDClient('token')
44
- print(Me())
45
- ```
46
- <!--
47
- > [!NOTE]
48
- > Берите refresh_token из запроса /auth/refresh. В остальных запросах нету refresh_token
49
- > ![cookie](cookie-screen.png) -->
50
-
51
- ### Получение cookies
52
-
53
- Для получения access_token требуются cookies с `refresh_token`. Как их получить:
54
-
55
- 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
56
- 2. Откройте DevTools (F12)
57
- 3. Перейдите на вкладку **Network**
58
- 4. Обновите страницу
59
- 5. Найдите запрос к `/auth/refresh`
60
- 6. Скопируйте значение **refresh_token** из **Cookie** из Request Headers
61
-
62
- ![cookie](cookie-screen.png)
63
-
64
-
65
- ## API
66
- ```python
67
- from itd import Me, User, Post, Posts, File, Hashtag, Notifications
68
-
69
- me = Me() # получить себя
70
- me.privacy.update(is_private=True)
71
-
72
- user = User('itd_sdk') # получить пользователя
73
- user.follow()
74
-
75
- post = Post('725681ba-2aaa-42d8-87fb-490c0f44e162') # получить пост
76
- post.like()
77
- post.add_comment('тест комент 6 7')
78
-
79
- posts = Posts() # получить посты из ленты
80
- for i, post in enumerate(Posts()):
81
- post.like() # встроенные защиты, из-за которых рейт-лимит будет получить сложнее + авто ожидание окончания рейт лимита
82
- if i > 10:
83
- break
84
-
85
- post = user.posts[5] # индексация, авто-получение до нужного значения
86
- post.repost()
87
-
88
- file = File.from_path('1.jpg') # загрузка файлов
89
- Post.new('всем привет!', attachments=file) # attachments может быть списком, файлом, или UUID
90
-
91
- hashtag = Hashtag('тестапи') # получить данные хэштэга
92
- print(hashtag.posts_count)
93
- hashtag.posts[0].like()
94
-
95
- notifications = Notifications() # получить уведы
96
- notifications[30].read()
97
- notifications.read_all()
98
- for notification in notifications.stream(): # SSE уведомлений
99
- print(notification.type.value)
100
- break
101
-
102
- def on_like(notification):
103
- print('лайк от', notification.actor.username)
104
- notifications.stop_stream()
105
- notifications.on_like = on_like
106
- stream = notifications.stream_bg() # background SSE
107
-
108
- Post('02bcbba4-f365-4b98-9291-d0bc1fb36fe4').poll.vote('тест') # голосования в опросах
109
-
110
- ```
111
-
112
- ### Кастомные запросы
113
-
114
- ```python
115
- from itd.request import fetch
116
-
117
- fetch(c, 'метод', 'эндпоинт', {'данные': 'данные'})
118
- ```
119
- Из методов поддерживается `get`, `post`, `put` итд, которые есть в `requests`
120
- К названию эндпоинта добавляется домен итд и `api`, то есть в этом примере отправится `https://xn--d1ah4a.com/api/эндпоинт`.
121
-
122
- > [!NOTE]
123
- > `xn--d1ah4a.com` - punycode от "итд.com"
124
-
125
- ## Прочее
126
- - Лицезия: [MIT](./LICENSE)
127
- - Автор:
128
- - ИТД: [@itd_sdk](https://xn--d1ah4a.com/@itd_sdk) или [@fdg](https://xn--d1ah4a.com/@pingbot)
129
- - ТГ: [@desicars](https://t.me/desicars)
130
-
131
- [![Star History Chart](https://api.star-history.com/chart?repos=itd-sdk/itd-sdk&type=date&legend=top-left)](https://www.star-history.com/?repos=itd-sdk%2Fitd-sdk&type=date&legend=top-left)
30
+ # itd-sdk
31
+
32
+ [![ncruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/fi-res/ncruff)
33
+
34
+ SDK для работы с [https://xn--d1ah4a.com](итд.com) на python.
35
+
36
+ Документация: https://itdsdk.qzz.io/docs (wip)
37
+
38
+ ## Установка
39
+
40
+ ```bash
41
+ uv add itd-sdk
42
+ ```
43
+
44
+ или через pip:
45
+
46
+ ```bash
47
+ pip install itd-sdk
48
+ ```
49
+
50
+ ## Вход
51
+
52
+ Сейчас есть 3 способа авторизации в SDK:
53
+
54
+ 1. Без авторизации. Доступен поиск и хэштэги.
55
+ 2. Авторизация через `access_token`. Доступны все запросы кроме тех, которые связаны с авторизацией. Токен действует 15 минут.
56
+ 3. Авторизация через `refresh_token`. Доступны все запросы. Токен действует 7 дней.
57
+
58
+ ### Получение `refresh_token`
59
+
60
+ 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
61
+ 2. Откройте DevTools (<kbd>F12</kbd>)
62
+ 3. Перейдите на вкладку **"Network"** \ **"Сеть"**
63
+ 4. Обновите страницу
64
+ 5. Найдите запрос к `/v1/auth/refresh`
65
+ 6. Скопируйте значение **refresh_token** из **Cookies** \ **Куки**
66
+
67
+ ![token](get-rtoken.png)
68
+
69
+ ### Получение `access_token`
70
+
71
+ 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
72
+ 2. Откройте DevTools (<kbd>F12</kbd>)
73
+ 3. Перейдите на вкладку **"Network"** \ **"Сеть"**
74
+ 4. Откройте любой запрос (если запросов нету, подождите 1-3сек - итд постоянно посылает запросы на обновление статистики постов)
75
+ 5. Скопируйте значение **authozation** из **Request headers** \ **Заголовки запроса**
76
+
77
+ ![token](get-atoken.png)
78
+
79
+ ## API
80
+
81
+ ```python
82
+ from itd import Me, User, Post, Posts, File, Hashtag, Notifications
83
+
84
+ me = Me() # получить себя
85
+ me.privacy.update(is_private=True)
86
+
87
+ user = User('itd_sdk') # получить пользователя
88
+ user.follow()
89
+
90
+ post = Post('725681ba-2aaa-42d8-87fb-490c0f44e162') # получить пост
91
+ post.like()
92
+ post.add_comment('тест комент 6 7')
93
+ Post('02bcbba4-f365-4b98-9291-d0bc1fb36fe4').poll.vote('тест') # голосования в опросах
94
+
95
+ posts = Posts() # получить посты из ленты
96
+ for i, post in enumerate(Posts()):
97
+ post.like() # встроенные защиты, из-за которых рейт-лимит будет получить сложнее + авто ожидание окончания рейт лимита
98
+ if i > 10:
99
+ break
100
+
101
+ post = user.posts[5] # индексация, авто-получение до нужного значения
102
+ post.repost()
103
+
104
+ file = File.from_path('1.jpg') # загрузка файлов
105
+ Post.new('всем привет!', attachments=file) # attachments может быть списком, файлом, или UUID
106
+
107
+ hashtag = Hashtag('тестапи') # получить данные хэштэга
108
+ print(hashtag.posts_count)
109
+ hashtag.posts[0].like()
110
+
111
+ notifications = Notifications() # получить уведы
112
+ notifications[30].read()
113
+ notifications.read_all()
114
+ for notification in notifications.stream(): # SSE уведомлений
115
+ print(notification.type.value)
116
+ break
117
+
118
+ def on_like(notification):
119
+ print('лайк от', notification.actor.username)
120
+ notifications.stop_stream()
121
+ notifications.on_like = on_like
122
+ stream = notifications.stream_bg() # background SSE
123
+ ```
124
+
125
+ Весь API - https://itdsdk.qzz.io/docs/
126
+
127
+ ## Прочее
128
+
129
+ - Лицезия: [MIT](./LICENSE)
130
+ - Автор:
131
+ - ИТД: [@itd_sdk](https://xn--d1ah4a.com/@itd_sdk) или [@fdg](https://xn--d1ah4a.com/@pingbot)
132
+ - ТГ: [@desicars](https://t.me/desicars)
133
+
134
+ [![Star History Chart](https://api.star-history.com/chart?repos=itd-sdk/itd-sdk&type=date&legend=top-left)](https://www.star-history.com/?repos=itd-sdk%2Fitd-sdk&type=date&legend=top-left)
@@ -1,104 +1,105 @@
1
- # itd-sdk
2
- Клиент ITD для python
3
- Документация (beta): https://itdsdk.qzz.io/docs
4
-
5
- ## Установка
6
-
7
- ```bash
8
- pip install itd-sdk
9
- ```
10
-
11
- ## Пример
12
-
13
- ```python
14
- from itd import ITDClient, Me
15
-
16
- c = ITDClient('token')
17
- print(Me())
18
- ```
19
- <!--
20
- > [!NOTE]
21
- > Берите refresh_token из запроса /auth/refresh. В остальных запросах нету refresh_token
22
- > ![cookie](cookie-screen.png) -->
23
-
24
- ### Получение cookies
25
-
26
- Для получения access_token требуются cookies с `refresh_token`. Как их получить:
27
-
28
- 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
29
- 2. Откройте DevTools (F12)
30
- 3. Перейдите на вкладку **Network**
31
- 4. Обновите страницу
32
- 5. Найдите запрос к `/auth/refresh`
33
- 6. Скопируйте значение **refresh_token** из **Cookie** из Request Headers
34
-
35
- ![cookie](cookie-screen.png)
36
-
37
-
38
- ## API
39
- ```python
40
- from itd import Me, User, Post, Posts, File, Hashtag, Notifications
41
-
42
- me = Me() # получить себя
43
- me.privacy.update(is_private=True)
44
-
45
- user = User('itd_sdk') # получить пользователя
46
- user.follow()
47
-
48
- post = Post('725681ba-2aaa-42d8-87fb-490c0f44e162') # получить пост
49
- post.like()
50
- post.add_comment('тест комент 6 7')
51
-
52
- posts = Posts() # получить посты из ленты
53
- for i, post in enumerate(Posts()):
54
- post.like() # встроенные защиты, из-за которых рейт-лимит будет получить сложнее + авто ожидание окончания рейт лимита
55
- if i > 10:
56
- break
57
-
58
- post = user.posts[5] # индексация, авто-получение до нужного значения
59
- post.repost()
60
-
61
- file = File.from_path('1.jpg') # загрузка файлов
62
- Post.new('всем привет!', attachments=file) # attachments может быть списком, файлом, или UUID
63
-
64
- hashtag = Hashtag('тестапи') # получить данные хэштэга
65
- print(hashtag.posts_count)
66
- hashtag.posts[0].like()
67
-
68
- notifications = Notifications() # получить уведы
69
- notifications[30].read()
70
- notifications.read_all()
71
- for notification in notifications.stream(): # SSE уведомлений
72
- print(notification.type.value)
73
- break
74
-
75
- def on_like(notification):
76
- print('лайк от', notification.actor.username)
77
- notifications.stop_stream()
78
- notifications.on_like = on_like
79
- stream = notifications.stream_bg() # background SSE
80
-
81
- Post('02bcbba4-f365-4b98-9291-d0bc1fb36fe4').poll.vote('тест') # голосования в опросах
82
-
83
- ```
84
-
85
- ### Кастомные запросы
86
-
87
- ```python
88
- from itd.request import fetch
89
-
90
- fetch(c, 'метод', 'эндпоинт', {'данные': 'данные'})
91
- ```
92
- Из методов поддерживается `get`, `post`, `put` итд, которые есть в `requests`
93
- К названию эндпоинта добавляется домен итд и `api`, то есть в этом примере отправится `https://xn--d1ah4a.com/api/эндпоинт`.
94
-
95
- > [!NOTE]
96
- > `xn--d1ah4a.com` - punycode от "итд.com"
97
-
98
- ## Прочее
99
- - Лицезия: [MIT](./LICENSE)
100
- - Автор:
101
- - ИТД: [@itd_sdk](https://xn--d1ah4a.com/@itd_sdk) или [@fdg](https://xn--d1ah4a.com/@pingbot)
102
- - ТГ: [@desicars](https://t.me/desicars)
103
-
104
- [![Star History Chart](https://api.star-history.com/chart?repos=itd-sdk/itd-sdk&type=date&legend=top-left)](https://www.star-history.com/?repos=itd-sdk%2Fitd-sdk&type=date&legend=top-left)
1
+ # itd-sdk
2
+
3
+ [![ncruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/fi-res/ncruff)
4
+
5
+ SDK для работы с [https://xn--d1ah4a.com](итд.com) на python.
6
+
7
+ Документация: https://itdsdk.qzz.io/docs (wip)
8
+
9
+ ## Установка
10
+
11
+ ```bash
12
+ uv add itd-sdk
13
+ ```
14
+
15
+ или через pip:
16
+
17
+ ```bash
18
+ pip install itd-sdk
19
+ ```
20
+
21
+ ## Вход
22
+
23
+ Сейчас есть 3 способа авторизации в SDK:
24
+
25
+ 1. Без авторизации. Доступен поиск и хэштэги.
26
+ 2. Авторизация через `access_token`. Доступны все запросы кроме тех, которые связаны с авторизацией. Токен действует 15 минут.
27
+ 3. Авторизация через `refresh_token`. Доступны все запросы. Токен действует 7 дней.
28
+
29
+ ### Получение `refresh_token`
30
+
31
+ 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
32
+ 2. Откройте DevTools (<kbd>F12</kbd>)
33
+ 3. Перейдите на вкладку **"Network"** \ **"Сеть"**
34
+ 4. Обновите страницу
35
+ 5. Найдите запрос к `/v1/auth/refresh`
36
+ 6. Скопируйте значение **refresh_token** из **Cookies** \ **Куки**
37
+
38
+ ![token](get-rtoken.png)
39
+
40
+ ### Получение `access_token`
41
+
42
+ 1. Откройте [итд.com](https://xn--d1ah4a.com) в браузере
43
+ 2. Откройте DevTools (<kbd>F12</kbd>)
44
+ 3. Перейдите на вкладку **"Network"** \ **"Сеть"**
45
+ 4. Откройте любой запрос (если запросов нету, подождите 1-3сек - итд постоянно посылает запросы на обновление статистики постов)
46
+ 5. Скопируйте значение **authozation** из **Request headers** \ **Заголовки запроса**
47
+
48
+ ![token](get-atoken.png)
49
+
50
+ ## API
51
+
52
+ ```python
53
+ from itd import Me, User, Post, Posts, File, Hashtag, Notifications
54
+
55
+ me = Me() # получить себя
56
+ me.privacy.update(is_private=True)
57
+
58
+ user = User('itd_sdk') # получить пользователя
59
+ user.follow()
60
+
61
+ post = Post('725681ba-2aaa-42d8-87fb-490c0f44e162') # получить пост
62
+ post.like()
63
+ post.add_comment('тест комент 6 7')
64
+ Post('02bcbba4-f365-4b98-9291-d0bc1fb36fe4').poll.vote('тест') # голосования в опросах
65
+
66
+ posts = Posts() # получить посты из ленты
67
+ for i, post in enumerate(Posts()):
68
+ post.like() # встроенные защиты, из-за которых рейт-лимит будет получить сложнее + авто ожидание окончания рейт лимита
69
+ if i > 10:
70
+ break
71
+
72
+ post = user.posts[5] # индексация, авто-получение до нужного значения
73
+ post.repost()
74
+
75
+ file = File.from_path('1.jpg') # загрузка файлов
76
+ Post.new('всем привет!', attachments=file) # attachments может быть списком, файлом, или UUID
77
+
78
+ hashtag = Hashtag('тестапи') # получить данные хэштэга
79
+ print(hashtag.posts_count)
80
+ hashtag.posts[0].like()
81
+
82
+ notifications = Notifications() # получить уведы
83
+ notifications[30].read()
84
+ notifications.read_all()
85
+ for notification in notifications.stream(): # SSE уведомлений
86
+ print(notification.type.value)
87
+ break
88
+
89
+ def on_like(notification):
90
+ print('лайк от', notification.actor.username)
91
+ notifications.stop_stream()
92
+ notifications.on_like = on_like
93
+ stream = notifications.stream_bg() # background SSE
94
+ ```
95
+
96
+ Весь API - https://itdsdk.qzz.io/docs/
97
+
98
+ ## Прочее
99
+
100
+ - Лицезия: [MIT](./LICENSE)
101
+ - Автор:
102
+ - ИТД: [@itd_sdk](https://xn--d1ah4a.com/@itd_sdk) или [@fdg](https://xn--d1ah4a.com/@pingbot)
103
+ - ТГ: [@desicars](https://t.me/desicars)
104
+
105
+ [![Star History Chart](https://api.star-history.com/chart?repos=itd-sdk/itd-sdk&type=date&legend=top-left)](https://www.star-history.com/?repos=itd-sdk%2Fitd-sdk&type=date&legend=top-left)
@@ -0,0 +1,65 @@
1
+ # ###################### ####
2
+ #### ## ###################### ########
3
+ #### #### #### #### ####
4
+ #### ###### #### #### ####
5
+ #### ####### #### #### ####
6
+ #### ######### #### #### ####
7
+ #### ##### #### #### #### ####
8
+ #### ##### #### #### #### ####
9
+ #### ##### #### #### #### ####
10
+ ######### #### #### #### #### +---- +----\ | /
11
+ ####### #### #### ################################## | | | | /
12
+ ##### #### #### #################################### - +---+ | | ++
13
+ ### #### #### #### #### | | | | \
14
+ # #### ### #### #### ----+ +----/ | \
15
+ """
16
+ |]]]]<<<<<]]<<]]]]]]]]]]]]]]<<<<<]]
17
+
18
+ |]]]]<<<]]]]]]<<<<<]]<<<<<<<]]<]]
19
+
20
+ |]]]]<]]]]<]]]]<<<<<]]<<<<<<]]<<<]]
21
+
22
+ |]]]]]]<<<]]]]<<<<<]]<<<]]]]]]]]]]]]]]]]]]]]]]
23
+
24
+ |]]<<<<<]]]]<<<<<]]<<<]]<<<<<<<<]]
25
+ """
26
+
27
+ from importlib.metadata import version
28
+
29
+ __version__ = version("itd-sdk")
30
+
31
+ from itd.clan import Clan, TopClans
32
+ from itd.client import Client as ITDClient
33
+ from itd.client import Config as ITDConfig
34
+ from itd.file import File
35
+ from itd.hashtag import Hashtag, Hashtags
36
+ from itd.notification import Notifications
37
+ from itd.poll import NewPoll
38
+ from itd.post import HashtagPosts, LikedPosts, Post, Posts, UserPosts
39
+ from itd.session import Sessions
40
+ from itd.user import Me, User, Users, get_follow_status
41
+ from itd.version import Apps, Changelog
42
+
43
+ __all__ = [
44
+ 'Changelog',
45
+ 'Apps',
46
+ 'ITDClient',
47
+ 'ITDConfig',
48
+ 'Clan',
49
+ 'TopClans',
50
+ 'File',
51
+ 'Hashtag',
52
+ 'Hashtags',
53
+ 'Notifications',
54
+ 'Post',
55
+ 'Posts',
56
+ 'UserPosts',
57
+ 'HashtagPosts',
58
+ 'LikedPosts',
59
+ 'NewPoll',
60
+ 'Sessions',
61
+ 'User',
62
+ 'Me',
63
+ 'Users',
64
+ 'get_follow_status'
65
+ ]
@@ -1,17 +1,19 @@
1
- from __future__ import annotations
2
- from typing import TYPE_CHECKING
3
-
4
- if TYPE_CHECKING:
5
- from itd.client import Client
6
-
7
- _default_client: Client | None = None
8
-
9
- def get_default_client() -> Client:
10
- global _default_client
11
- if _default_client is None:
12
- raise
13
- return _default_client
14
-
15
- def set_default_client(client: Client):
16
- global _default_client
17
- _default_client = client
1
+ from __future__ import annotations
2
+ from typing import TYPE_CHECKING
3
+
4
+ if TYPE_CHECKING:
5
+ from itd.client import Client
6
+
7
+ _default_client: Client | None = None
8
+
9
+
10
+ def get_default_client() -> Client:
11
+ global _default_client
12
+ if _default_client is None:
13
+ raise
14
+ return _default_client
15
+
16
+
17
+ def set_default_client(client: Client):
18
+ global _default_client
19
+ _default_client = client
File without changes
@@ -1,35 +1,45 @@
1
- from __future__ import annotations
2
- from typing import TYPE_CHECKING
3
-
4
- from requests import Response
5
-
6
- from itd.base import catch_errors, rate_limit
7
- from itd.enums import AuthLevel
8
- from itd.exceptions import (
9
- InvalidPasswordError, SamePasswordError, InvalidOldPasswordError, SessionNotFoundError,
10
- SessionExpiredError, SessionRevokedError, InvalidCredentials, CaptchaFailedError,
11
- EmailDomainNotAllowed
12
- )
13
- if TYPE_CHECKING:
14
- from itd.client import Client
15
-
16
- @rate_limit()
17
- @catch_errors(SessionExpiredError(), SessionNotFoundError(), SessionRevokedError())
18
- def refresh_token(client: Client) -> Response:
19
- return client.request('post', 'v1/auth/refresh', level=AuthLevel.REFRESH)
20
-
21
- @rate_limit()
22
- @catch_errors(InvalidPasswordError(), SamePasswordError(), InvalidOldPasswordError())
23
- def change_password(client: Client, old: str, new: str) -> Response:
24
- return client.request('post', 'v1/auth/change-password', {'newPassword': new, 'oldPassword': old})
25
-
26
- @rate_limit()
27
- @catch_errors()
28
- def logout(client: Client) -> Response:
29
- return client.request('post', 'v1/auth/logout', level=AuthLevel.REFRESH)
30
-
31
-
32
- @rate_limit()
33
- @catch_errors(InvalidCredentials(), CaptchaFailedError(), EmailDomainNotAllowed())
34
- def sign_in(client: Client, email: str, password: str, turnstile: str):
35
- return client.request('post', 'v1/auth/sign-in', {'email': email, 'password': password, 'turnstileToken': turnstile}, level=AuthLevel.NO)
1
+ from __future__ import annotations
2
+ from typing import TYPE_CHECKING
3
+
4
+ from requests import Response
5
+
6
+ from itd.base import catch_errors, rate_limit
7
+ from itd.enums import AuthLevel
8
+ from itd.exceptions import (
9
+ InvalidPasswordError,
10
+ SamePasswordError,
11
+ InvalidOldPasswordError,
12
+ SessionNotFoundError,
13
+ SessionExpiredError,
14
+ SessionRevokedError,
15
+ InvalidCredentials,
16
+ CaptchaFailedError,
17
+ EmailDomainNotAllowed
18
+ )
19
+
20
+ if TYPE_CHECKING:
21
+ from itd.client import Client
22
+
23
+
24
+ @rate_limit()
25
+ @catch_errors(SessionExpiredError(), SessionNotFoundError(), SessionRevokedError())
26
+ def refresh_token(client: Client) -> Response:
27
+ return client.request('post', 'v1/auth/refresh', level=AuthLevel.REFRESH)
28
+
29
+
30
+ @rate_limit()
31
+ @catch_errors(InvalidPasswordError(), SamePasswordError(), InvalidOldPasswordError())
32
+ def change_password(client: Client, old: str, new: str) -> Response:
33
+ return client.request('post', 'v1/auth/change-password', {'newPassword': new, 'oldPassword': old})
34
+
35
+
36
+ @rate_limit()
37
+ @catch_errors()
38
+ def logout(client: Client) -> Response:
39
+ return client.request('post', 'v1/auth/logout', level=AuthLevel.REFRESH)
40
+
41
+
42
+ @rate_limit()
43
+ @catch_errors(InvalidCredentials(), CaptchaFailedError(), EmailDomainNotAllowed())
44
+ def sign_in(client: Client, email: str, password: str, turnstile: str):
45
+ return client.request('post', 'v1/auth/sign-in', {'email': email, 'password': password, 'turnstileToken': turnstile}, level=AuthLevel.NO)