smsaero-api-async 3.0.0__tar.gz → 3.1.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.
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/CONTRIBUTING.md +1 -1
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/PKG-INFO +23 -7
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/README.md +19 -2
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/setup.py +6 -7
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero/__init__.py +106 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/PKG-INFO +23 -7
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/tests/test_smsaero.py +89 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/tests/test_validators.py +26 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/AUTHORS.md +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/LICENSE +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/MANIFEST.in +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/setup.cfg +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero/command_line.py +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/SOURCES.txt +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/dependency_links.txt +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/entry_points.txt +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/not-zip-safe +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/requires.txt +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/top_level.txt +0 -0
- {smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/tests/test_devmode.py +0 -0
@@ -93,4 +93,4 @@ Before you submit a pull request, check that it meets these guidelines:
|
|
93
93
|
|
94
94
|
1. The pull request should include tests.
|
95
95
|
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.md.
|
96
|
-
3. The pull request should work with Python 3.
|
96
|
+
3. The pull request should work with Python 3.7+, PyPy. Check [https://travis-ci.org/smsaero/smsaero_python_async/pull_requests](https://travis-ci.org/smsaero/smsaero_python_async/pull_requests) and make sure that the tests pass for all supported Python versions.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: smsaero_api_async
|
3
|
-
Version: 3.
|
4
|
-
Summary:
|
3
|
+
Version: 3.1.0
|
4
|
+
Summary: SMS Aero Async API client
|
5
5
|
Home-page: https://github.com/smsaero/smsaero_python/
|
6
|
-
Author:
|
6
|
+
Author: SMS Aero
|
7
7
|
Author-email: admin@smsaero.ru
|
8
8
|
License: MIT
|
9
9
|
Keywords: smsaero,api,smsaero_api_async,sms,hlr,viber
|
@@ -13,7 +13,6 @@ Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
14
14
|
Classifier: Operating System :: OS Independent
|
15
15
|
Classifier: Programming Language :: Python
|
16
|
-
Classifier: Programming Language :: Python :: 3.6
|
17
16
|
Classifier: Programming Language :: Python :: 3.7
|
18
17
|
Classifier: Programming Language :: Python :: 3.8
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
@@ -27,7 +26,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
26
|
Classifier: Topic :: Communications :: Telephony
|
28
27
|
Classifier: Topic :: Internet :: WWW/HTTP
|
29
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
30
|
-
Requires-Python: >=3.
|
29
|
+
Requires-Python: >=3.7
|
31
30
|
Description-Content-Type: text/markdown
|
32
31
|
License-File: LICENSE
|
33
32
|
License-File: AUTHORS.md
|
@@ -45,7 +44,7 @@ Requires-Dist: bandit>=1.7.9; extra == "dev"
|
|
45
44
|
Requires-Dist: build>=1.2.1; extra == "dev"
|
46
45
|
Requires-Dist: twine>=5.1.1; extra == "dev"
|
47
46
|
|
48
|
-
#
|
47
|
+
# Python async library for sending SMS messages via SMS Aero API
|
49
48
|
|
50
49
|
[](https://badge.fury.io/py/smsaero-api-async)
|
51
50
|
[](https://pypi.org/project/smsaero-api-async/)
|
@@ -88,8 +87,25 @@ async def send_sms(phone: int, message: str) -> None:
|
|
88
87
|
await api.close_session()
|
89
88
|
|
90
89
|
|
90
|
+
async def send_telegram_code(phone: int, code: int) -> None:
|
91
|
+
"""
|
92
|
+
Sends a Telegram code
|
93
|
+
|
94
|
+
Parameters:
|
95
|
+
phone (int): The phone number to which the Telegram code will be sent.
|
96
|
+
code (int): The Telegram code (4 to 8 digits).
|
97
|
+
"""
|
98
|
+
api = smsaero.SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
|
99
|
+
try:
|
100
|
+
result = await api.send_telegram(phone, code)
|
101
|
+
pprint.pprint(result)
|
102
|
+
finally:
|
103
|
+
await api.close_session()
|
104
|
+
|
105
|
+
|
91
106
|
if __name__ == '__main__':
|
92
107
|
asyncio.run(send_sms(70000000000, 'Hello, World!'))
|
108
|
+
asyncio.run(send_telegram_code(79990000000, 1234))
|
93
109
|
```
|
94
110
|
|
95
111
|
#### Exceptions:
|
@@ -117,7 +133,7 @@ docker run -it --rm 'smsaero/smsaero_python_async:latest' smsaero_send --email "
|
|
117
133
|
|
118
134
|
## Compatibility:
|
119
135
|
|
120
|
-
* Currently version of library is compatible with Python 3.
|
136
|
+
* Currently version of library is compatible with Python 3.7+.
|
121
137
|
|
122
138
|
|
123
139
|
## License:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Python async library for sending SMS messages via SMS Aero API
|
2
2
|
|
3
3
|
[](https://badge.fury.io/py/smsaero-api-async)
|
4
4
|
[](https://pypi.org/project/smsaero-api-async/)
|
@@ -41,8 +41,25 @@ async def send_sms(phone: int, message: str) -> None:
|
|
41
41
|
await api.close_session()
|
42
42
|
|
43
43
|
|
44
|
+
async def send_telegram_code(phone: int, code: int) -> None:
|
45
|
+
"""
|
46
|
+
Sends a Telegram code
|
47
|
+
|
48
|
+
Parameters:
|
49
|
+
phone (int): The phone number to which the Telegram code will be sent.
|
50
|
+
code (int): The Telegram code (4 to 8 digits).
|
51
|
+
"""
|
52
|
+
api = smsaero.SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
|
53
|
+
try:
|
54
|
+
result = await api.send_telegram(phone, code)
|
55
|
+
pprint.pprint(result)
|
56
|
+
finally:
|
57
|
+
await api.close_session()
|
58
|
+
|
59
|
+
|
44
60
|
if __name__ == '__main__':
|
45
61
|
asyncio.run(send_sms(70000000000, 'Hello, World!'))
|
62
|
+
asyncio.run(send_telegram_code(79990000000, 1234))
|
46
63
|
```
|
47
64
|
|
48
65
|
#### Exceptions:
|
@@ -70,7 +87,7 @@ docker run -it --rm 'smsaero/smsaero_python_async:latest' smsaero_send --email "
|
|
70
87
|
|
71
88
|
## Compatibility:
|
72
89
|
|
73
|
-
* Currently version of library is compatible with Python 3.
|
90
|
+
* Currently version of library is compatible with Python 3.7+.
|
74
91
|
|
75
92
|
|
76
93
|
## License:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Setup script for the
|
1
|
+
"""Setup script for the SMS Aero API client package."""
|
2
2
|
|
3
3
|
from setuptools import setup, find_packages
|
4
4
|
|
@@ -9,8 +9,8 @@ with open("README.md", "r", encoding="utf-8") as file:
|
|
9
9
|
|
10
10
|
setup(
|
11
11
|
name="smsaero_api_async",
|
12
|
-
version="3.
|
13
|
-
description="
|
12
|
+
version="3.1.0",
|
13
|
+
description="SMS Aero Async API client",
|
14
14
|
keywords=[
|
15
15
|
"smsaero",
|
16
16
|
"api",
|
@@ -21,13 +21,13 @@ setup(
|
|
21
21
|
],
|
22
22
|
long_description=long_description,
|
23
23
|
long_description_content_type="text/markdown",
|
24
|
-
author="
|
24
|
+
author="SMS Aero",
|
25
25
|
author_email="admin@smsaero.ru",
|
26
26
|
help_center="https://smsaero.ru/support/",
|
27
27
|
url="https://github.com/smsaero/smsaero_python/",
|
28
28
|
license="MIT",
|
29
29
|
packages=find_packages(exclude=["tests", "tests.*"]),
|
30
|
-
python_requires=">=3.
|
30
|
+
python_requires=">=3.7",
|
31
31
|
include_package_data=True,
|
32
32
|
install_requires=[
|
33
33
|
"setuptools",
|
@@ -55,7 +55,6 @@ setup(
|
|
55
55
|
"License :: OSI Approved :: MIT License",
|
56
56
|
"Operating System :: OS Independent",
|
57
57
|
"Programming Language :: Python",
|
58
|
-
"Programming Language :: Python :: 3.6",
|
59
58
|
"Programming Language :: Python :: 3.7",
|
60
59
|
"Programming Language :: Python :: 3.8",
|
61
60
|
"Programming Language :: Python :: 3.9",
|
@@ -76,6 +75,6 @@ setup(
|
|
76
75
|
],
|
77
76
|
},
|
78
77
|
options={
|
79
|
-
"bdist_wheel": {"universal":
|
78
|
+
"bdist_wheel": {"universal": False},
|
80
79
|
},
|
81
80
|
)
|
@@ -1103,6 +1103,77 @@ class SmsAero:
|
|
1103
1103
|
self.page_validate(page)
|
1104
1104
|
return await self.request("viber/statistic", {"sendingId": int(sending_id)}, page=page)
|
1105
1105
|
|
1106
|
+
async def send_telegram(
|
1107
|
+
self,
|
1108
|
+
number: Union[int, List[int]],
|
1109
|
+
code: int,
|
1110
|
+
sign: Optional[str] = None,
|
1111
|
+
text: Optional[str] = None,
|
1112
|
+
) -> Dict:
|
1113
|
+
"""
|
1114
|
+
Sends a Telegram code to the specified number or numbers.
|
1115
|
+
|
1116
|
+
Parameters:
|
1117
|
+
number (Union[int, List[int]]): The recipient's phone number or a list of phone numbers.
|
1118
|
+
code (int): The Telegram code (4 to 8 digits).
|
1119
|
+
sign (str, optional): The SMS sender name.
|
1120
|
+
text (str, optional): The SMS message text.
|
1121
|
+
|
1122
|
+
When using text and sign parameters, if the Telegram code is not delivered,
|
1123
|
+
an SMS will be sent with the specified values.
|
1124
|
+
|
1125
|
+
Returns:
|
1126
|
+
Dict: The server's response in JSON format.
|
1127
|
+
|
1128
|
+
Example response:
|
1129
|
+
{
|
1130
|
+
"id": 1,
|
1131
|
+
"number": "79990000000",
|
1132
|
+
"telegramCode": "1234",
|
1133
|
+
"smsText": "Ваш код 1234",
|
1134
|
+
"smsFrom": "SMS Aero",
|
1135
|
+
"idSms": null,
|
1136
|
+
"status": 0,
|
1137
|
+
"extendStatus": "queue",
|
1138
|
+
"cost": "1.00",
|
1139
|
+
"dateCreate": 1732796285
|
1140
|
+
}
|
1141
|
+
"""
|
1142
|
+
self.send_telegram_validate(number, code, sign, text)
|
1143
|
+
data: Dict = {"code": int(code)}
|
1144
|
+
data.update(**self.fill_nums(number))
|
1145
|
+
if sign:
|
1146
|
+
data["sign"] = sign
|
1147
|
+
if text:
|
1148
|
+
data["text"] = text
|
1149
|
+
return await self.request("telegram/send", data)
|
1150
|
+
|
1151
|
+
async def telegram_status(self, telegram_id: int) -> Dict:
|
1152
|
+
"""
|
1153
|
+
Retrieves the status of a Telegram code delivery.
|
1154
|
+
|
1155
|
+
Parameters:
|
1156
|
+
telegram_id (int): The message ID returned by the service when sending.
|
1157
|
+
|
1158
|
+
Returns:
|
1159
|
+
Dict: The server's response in JSON format.
|
1160
|
+
|
1161
|
+
Example response:
|
1162
|
+
{
|
1163
|
+
"id": 1,
|
1164
|
+
"number": "79990000000",
|
1165
|
+
"telegramCode": "1234",
|
1166
|
+
"smsText": "Ваш код 1234",
|
1167
|
+
"smsFrom": "SMS Aero",
|
1168
|
+
"idSms": null,
|
1169
|
+
"status": 1,
|
1170
|
+
"extendStatus": "delivery",
|
1171
|
+
"cost": "1.00",
|
1172
|
+
"dateCreate": 1732796285
|
1173
|
+
}
|
1174
|
+
"""
|
1175
|
+
return await self.request("telegram/status", {"id": int(telegram_id)})
|
1176
|
+
|
1106
1177
|
def phone_validation(self, number: Union[int, List[int]]) -> None:
|
1107
1178
|
"""
|
1108
1179
|
Validates the phone number or a list of phone numbers.
|
@@ -1380,6 +1451,41 @@ class SmsAero:
|
|
1380
1451
|
raise TypeError("Surname must be a string.")
|
1381
1452
|
self.page_validate(page)
|
1382
1453
|
|
1454
|
+
def send_telegram_validate(
|
1455
|
+
self,
|
1456
|
+
number: Union[int, List[int]],
|
1457
|
+
code: int,
|
1458
|
+
sign: Optional[str] = None,
|
1459
|
+
text: Optional[str] = None,
|
1460
|
+
) -> None:
|
1461
|
+
"""
|
1462
|
+
Validates the parameters for the send_telegram method.
|
1463
|
+
|
1464
|
+
Parameters:
|
1465
|
+
number (Union[int, List[int]]): The recipient's phone number or a list of phone numbers.
|
1466
|
+
code (int): The Telegram code (4 to 8 digits).
|
1467
|
+
sign (str, optional): The SMS sender name.
|
1468
|
+
text (str, optional): The SMS message text.
|
1469
|
+
|
1470
|
+
Raises:
|
1471
|
+
TypeError: If any of the parameters have an incorrect type.
|
1472
|
+
ValueError: If any of the parameters have an incorrect value.
|
1473
|
+
"""
|
1474
|
+
if not isinstance(code, int):
|
1475
|
+
raise TypeError("code must be an integer")
|
1476
|
+
if not 4 <= len(str(code)) <= 8:
|
1477
|
+
raise ValueError("Length of code must be between 4 and 8 digits")
|
1478
|
+
if sign is not None and not isinstance(sign, str):
|
1479
|
+
raise TypeError("sign must be a string")
|
1480
|
+
if sign is not None and not 2 <= len(sign) <= 64:
|
1481
|
+
raise ValueError("Length of sign must be between 2 and 64 characters")
|
1482
|
+
if text is not None and not isinstance(text, str):
|
1483
|
+
raise TypeError("text must be a string")
|
1484
|
+
if text is not None and not 2 <= len(text) <= 640:
|
1485
|
+
raise ValueError("Length of text must be between 2 and 640 characters")
|
1486
|
+
|
1487
|
+
self.phone_validation(number)
|
1488
|
+
|
1383
1489
|
@staticmethod
|
1384
1490
|
def init_validate(
|
1385
1491
|
api_key: str,
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: smsaero_api_async
|
3
|
-
Version: 3.
|
4
|
-
Summary:
|
3
|
+
Version: 3.1.0
|
4
|
+
Summary: SMS Aero Async API client
|
5
5
|
Home-page: https://github.com/smsaero/smsaero_python/
|
6
|
-
Author:
|
6
|
+
Author: SMS Aero
|
7
7
|
Author-email: admin@smsaero.ru
|
8
8
|
License: MIT
|
9
9
|
Keywords: smsaero,api,smsaero_api_async,sms,hlr,viber
|
@@ -13,7 +13,6 @@ Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
14
14
|
Classifier: Operating System :: OS Independent
|
15
15
|
Classifier: Programming Language :: Python
|
16
|
-
Classifier: Programming Language :: Python :: 3.6
|
17
16
|
Classifier: Programming Language :: Python :: 3.7
|
18
17
|
Classifier: Programming Language :: Python :: 3.8
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
@@ -27,7 +26,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
26
|
Classifier: Topic :: Communications :: Telephony
|
28
27
|
Classifier: Topic :: Internet :: WWW/HTTP
|
29
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
30
|
-
Requires-Python: >=3.
|
29
|
+
Requires-Python: >=3.7
|
31
30
|
Description-Content-Type: text/markdown
|
32
31
|
License-File: LICENSE
|
33
32
|
License-File: AUTHORS.md
|
@@ -45,7 +44,7 @@ Requires-Dist: bandit>=1.7.9; extra == "dev"
|
|
45
44
|
Requires-Dist: build>=1.2.1; extra == "dev"
|
46
45
|
Requires-Dist: twine>=5.1.1; extra == "dev"
|
47
46
|
|
48
|
-
#
|
47
|
+
# Python async library for sending SMS messages via SMS Aero API
|
49
48
|
|
50
49
|
[](https://badge.fury.io/py/smsaero-api-async)
|
51
50
|
[](https://pypi.org/project/smsaero-api-async/)
|
@@ -88,8 +87,25 @@ async def send_sms(phone: int, message: str) -> None:
|
|
88
87
|
await api.close_session()
|
89
88
|
|
90
89
|
|
90
|
+
async def send_telegram_code(phone: int, code: int) -> None:
|
91
|
+
"""
|
92
|
+
Sends a Telegram code
|
93
|
+
|
94
|
+
Parameters:
|
95
|
+
phone (int): The phone number to which the Telegram code will be sent.
|
96
|
+
code (int): The Telegram code (4 to 8 digits).
|
97
|
+
"""
|
98
|
+
api = smsaero.SmsAero(SMSAERO_EMAIL, SMSAERO_API_KEY)
|
99
|
+
try:
|
100
|
+
result = await api.send_telegram(phone, code)
|
101
|
+
pprint.pprint(result)
|
102
|
+
finally:
|
103
|
+
await api.close_session()
|
104
|
+
|
105
|
+
|
91
106
|
if __name__ == '__main__':
|
92
107
|
asyncio.run(send_sms(70000000000, 'Hello, World!'))
|
108
|
+
asyncio.run(send_telegram_code(79990000000, 1234))
|
93
109
|
```
|
94
110
|
|
95
111
|
#### Exceptions:
|
@@ -117,7 +133,7 @@ docker run -it --rm 'smsaero/smsaero_python_async:latest' smsaero_send --email "
|
|
117
133
|
|
118
134
|
## Compatibility:
|
119
135
|
|
120
|
-
* Currently version of library is compatible with Python 3.
|
136
|
+
* Currently version of library is compatible with Python 3.7+.
|
121
137
|
|
122
138
|
|
123
139
|
## License:
|
@@ -802,3 +802,92 @@ class TestSmsAero(unittest.TestCase):
|
|
802
802
|
"number": 79031234567,
|
803
803
|
},
|
804
804
|
)
|
805
|
+
|
806
|
+
@patch.object(SmsAero, "request")
|
807
|
+
async def test_send_telegram(self, mock_request):
|
808
|
+
mock_request.return_value = {
|
809
|
+
"id": 1,
|
810
|
+
"number": "79990000000",
|
811
|
+
"telegramCode": "1234",
|
812
|
+
"smsText": "Ваш код 1234",
|
813
|
+
"smsFrom": "SMS Aero",
|
814
|
+
"idSms": None,
|
815
|
+
"status": 0,
|
816
|
+
"extendStatus": "queue",
|
817
|
+
"cost": "1.00",
|
818
|
+
"dateCreate": 1732796285,
|
819
|
+
}
|
820
|
+
|
821
|
+
result = await self.smsaero.send_telegram(79990000000, 1234)
|
822
|
+
|
823
|
+
self.assertEqual(
|
824
|
+
result,
|
825
|
+
{
|
826
|
+
"id": 1,
|
827
|
+
"number": "79990000000",
|
828
|
+
"telegramCode": "1234",
|
829
|
+
"smsText": "Ваш код 1234",
|
830
|
+
"smsFrom": "SMS Aero",
|
831
|
+
"idSms": None,
|
832
|
+
"status": 0,
|
833
|
+
"extendStatus": "queue",
|
834
|
+
"cost": "1.00",
|
835
|
+
"dateCreate": 1732796285,
|
836
|
+
},
|
837
|
+
)
|
838
|
+
mock_request.assert_called_once_with("telegram/send", {"code": 1234, "number": 79990000000})
|
839
|
+
|
840
|
+
@patch.object(SmsAero, "request")
|
841
|
+
async def test_send_telegram_with_sign_and_text(self, mock_request):
|
842
|
+
mock_request.return_value = {"success": True}
|
843
|
+
|
844
|
+
result = await self.smsaero.send_telegram(79990000000, 1234, "TestSign", "Your code is 1234")
|
845
|
+
|
846
|
+
self.assertEqual(result, {"success": True})
|
847
|
+
mock_request.assert_called_once_with(
|
848
|
+
"telegram/send", {"code": 1234, "number": 79990000000, "sign": "TestSign", "text": "Your code is 1234"}
|
849
|
+
)
|
850
|
+
|
851
|
+
@patch.object(SmsAero, "request")
|
852
|
+
async def test_send_telegram_with_list_of_numbers(self, mock_request):
|
853
|
+
mock_request.return_value = {"success": True}
|
854
|
+
numbers = [79990000000, 79990000001]
|
855
|
+
|
856
|
+
result = await self.smsaero.send_telegram(numbers, 1234)
|
857
|
+
|
858
|
+
self.assertEqual(result, {"success": True})
|
859
|
+
mock_request.assert_called_once_with("telegram/send", {"code": 1234, "numbers": numbers})
|
860
|
+
|
861
|
+
@patch.object(SmsAero, "request")
|
862
|
+
async def test_telegram_status(self, mock_request):
|
863
|
+
mock_request.return_value = {
|
864
|
+
"id": 1,
|
865
|
+
"number": "79990000000",
|
866
|
+
"telegramCode": "1234",
|
867
|
+
"smsText": "Ваш код 1234",
|
868
|
+
"smsFrom": "SMS Aero",
|
869
|
+
"idSms": None,
|
870
|
+
"status": 1,
|
871
|
+
"extendStatus": "delivery",
|
872
|
+
"cost": "1.00",
|
873
|
+
"dateCreate": 1732796285,
|
874
|
+
}
|
875
|
+
|
876
|
+
result = await self.smsaero.telegram_status(1)
|
877
|
+
|
878
|
+
self.assertEqual(
|
879
|
+
result,
|
880
|
+
{
|
881
|
+
"id": 1,
|
882
|
+
"number": "79990000000",
|
883
|
+
"telegramCode": "1234",
|
884
|
+
"smsText": "Ваш код 1234",
|
885
|
+
"smsFrom": "SMS Aero",
|
886
|
+
"idSms": None,
|
887
|
+
"status": 1,
|
888
|
+
"extendStatus": "delivery",
|
889
|
+
"cost": "1.00",
|
890
|
+
"dateCreate": 1732796285,
|
891
|
+
},
|
892
|
+
)
|
893
|
+
mock_request.assert_called_once_with("telegram/status", {"id": 1})
|
@@ -335,3 +335,29 @@ class TestSmsAeroValidators(unittest.TestCase):
|
|
335
335
|
self.smsaero.contact_list_validate(page="invalid_page")
|
336
336
|
with self.assertRaises(ValueError):
|
337
337
|
self.smsaero.contact_list_validate(number=[79038805678, "invalid_number"])
|
338
|
+
|
339
|
+
def test_send_telegram_validate(self):
|
340
|
+
with self.assertRaises(TypeError):
|
341
|
+
self.smsaero.send_telegram_validate("invalid_number", 1234)
|
342
|
+
with self.assertRaises(TypeError):
|
343
|
+
self.smsaero.send_telegram_validate(79990000000, "invalid_code")
|
344
|
+
with self.assertRaises(TypeError):
|
345
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, 123)
|
346
|
+
with self.assertRaises(TypeError):
|
347
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, "sign", 123)
|
348
|
+
with self.assertRaises(ValueError):
|
349
|
+
self.smsaero.send_telegram_validate(79990000000, 123)
|
350
|
+
with self.assertRaises(ValueError):
|
351
|
+
self.smsaero.send_telegram_validate(79990000000, 123456789)
|
352
|
+
with self.assertRaises(ValueError):
|
353
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, "T")
|
354
|
+
with self.assertRaises(ValueError):
|
355
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, "T" * 65)
|
356
|
+
with self.assertRaises(ValueError):
|
357
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, "sign", "T")
|
358
|
+
with self.assertRaises(ValueError):
|
359
|
+
self.smsaero.send_telegram_validate(79990000000, 1234, "sign", "T" * 641)
|
360
|
+
with self.assertRaises(ValueError):
|
361
|
+
self.smsaero.send_telegram_validate(123, 1234)
|
362
|
+
with self.assertRaises(ValueError):
|
363
|
+
self.smsaero.send_telegram_validate([123, 1234567890123456], 1234)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/dependency_links.txt
RENAMED
File without changes
|
{smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/entry_points.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{smsaero_api_async-3.0.0 → smsaero_api_async-3.1.0}/smsaero_api_async.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|