Skip to content

Commit

Permalink
feat: отправка на несколько номеров
Browse files Browse the repository at this point in the history
Добавлена функция отправки на несколько номеров разных сообщений
  • Loading branch information
iredun committed Jan 19, 2021
1 parent 01aadc2 commit 6bc3c69
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions smsru/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SmsRuApi:
__api_id = None
__login = None
__password = None
__is_test = False
__is_test = 0
__from = None
__partner_id = None
__api_url = 'https://sms.ru/sms/'
Expand All @@ -32,7 +32,7 @@ def _get_settings(self):
raise KeyError(f"LOGIN and PASSWORD not found in {setting_key}")

self.__from = sms_ru.get('SENDER', None)
self.__is_test = sms_ru.get('TEST', False)
self.__is_test = int(sms_ru.get('TEST', False))

@staticmethod
def beautify_phone(phone: str) -> str:
Expand Down Expand Up @@ -67,6 +67,9 @@ def _sms_request(self, post_param: dict) -> dict:
else:
return_result = {k: False for k, v in post_param['multi'].items()}
phone_msg = post_param['multi']
multi = post_param.pop('multi')
for k, v in multi.items():
post_param[f'multi[{k}]'] = v

url = self.__api_url + 'send'
data = self.__request(url, post_param)
Expand Down Expand Up @@ -117,10 +120,7 @@ def validate_callback(self, data: list, hash: str) -> bool:
my_hash = self.__api_id + "".join(data)
return hash == hashlib.sha256(my_hash.encode('utf-8')).hexdigest()

def __send_multi_sms(self, phone_sms: dict) -> dict:
"""
Not tested func
"""
def send_multi_sms(self, phone_sms: dict) -> dict:
post_param = {
"multi": dict()
}
Expand Down

0 comments on commit 6bc3c69

Please sign in to comment.