kavenegar-python
kavenegar-python copied to clipboard
send_sms APIException
Hi there,
I am using kevenegar
to send SMS and it raises exception, for no reason!
This is my code:
api = KavenegarAPI('6F64***the-rest-of-my-api-key')
params = {'receptor': '091-the-rest-of-my-phone-number',
'message': '.وب سرویس پیام کوتاه کاوه نگار'}
response = api.sms_send(params)
And it will raise this error:
raise APIException((u'APIException[%s] %s' % (response['return']['status'],response['return']['message'])).encode('utf-8'))
kavenegar.APIException: b'APIException[426] \xd8\xa7\xd8\xb3\xd8\xaa\xd9\x81\xd8\xa7\xd8\xaf\xd9\x87 \xd8\xa7\xd8\xb2 \xd8\xa7\xdb\x8c\xd9\x86 \xd9\x85\xd8\xaa\xd8\xaf \xd9\x86\xdb\x8c\xd8\xa7\xd8\xb2\xd9\x85\xd9\x86\xd8\xaf \xd8\xb3\xd8\xb1\xd9\x88\xdb\x8c\xd8\xb3 \xd9\xbe\xdb\x8c\xd8\xb4\xd8\xb1\xd9\x81\xd8\xaa\xd9\x87 \xdb\x8c\xd8\xa7 \xd8\xa7\xdb\x8c\xd8\xac\xd8\xa7\xd8\xaf \xd8\xaf\xd8\xb3\xd8\xaa\xd8\xb1\xd8\xb3\xdb\x8c \xd9\x85\xdb\x8c \xd8\xa8\xd8\xa7\xd8\xb4\xd8\xaf'
Error code 426 means you need to use Advanced Service.
I got same error
Traceback (most recent call last):
File "sendsms.py", line 5, in
I got same error
Traceback (most recent call last): File "sendsms.py", line 5, in response = api.sms_send( params) File "/home/ubuntu/.local/lib/python3.8/site-packages/kavenegar.py", line 48, in sms_send return self._request('sms', 'send',params) File "/home/ubuntu/.local/lib/python3.8/site-packages/kavenegar.py", line 40, in _request raise APIException((u'APIException[%s] %s' % (response['return']['status'],response['return']['message'])).encode('utf-8')) kavenegar.APIException: b'APIException[412] \xd8\xa7\xd8\xb1\xd8\xb3\xd8\xa7\xd9\x84 \xda\xa9\xd9\x86\xd9\x86\xd8\xaf\xd9\x87 \xd9\x86\xd8\xa7\xd9\x85\xd8\xb9\xd8\xaa\xd8\xa8\xd8\xb1 \xd8\xa7\xd8\xb3\xd8\xaa'
did you figured out? i have the same error
kavenegar.APIException: b'APIException[412] \xd8\xa7\xd8\xb1\xd8\xb3\xd8\xa7\xd9\x84 \xda\xa9\xd9\x86\xd9\x86\xd8\xaf\xd9\x87 \xd9\x86\xd8\xa7\xd9\x85\xd8\xb9\xd8\xaa\xd8\xa8\xd8\xb1 \xd8\xa7\xd8\xb3\xd8\xaa'
I got this error either , can someone help us ?
Sender should be one of lines you can find in this address: Link
try:
api.sms_sendarray(params)
except kavenegar.APIException as e:
logger.error(ast.literal_eval(e.__str__()).decode("utf-8"))
raise CustomStatusCodeError(CustomStatusCode.SMS_ERROR, ast.literal_eval(e.__str__()).decode("utf-8"))