Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error using your API #3

Open
ognjen011 opened this issue Sep 6, 2019 · 2 comments
Open

Key error using your API #3

ognjen011 opened this issue Sep 6, 2019 · 2 comments

Comments

@ognjen011
Copy link

Ok so i am using your API in a very simple script to send sms out pretty much identical as your example. It worked for a couple of months without a problem. The other day i started to get an error like below. the message still gets delivered but i would like to resolve the below problem.
I just modified this line to pass a data as a variable:

#response = clickatell.sendMessage(['1111111111'], "My Message rest")
response = clickatell.sendMessage([to], content)

Error:

File "/usr/lib/zabbix/alertscripts/clickatellsms.py", line 14, in
response = clickatell.sendMessage([to], content)
File "/usr/local/lib/python2.7/dist-packages/clickatell/rest/init.py", line 40, in sendMessage
content = self.parseResponse(self.request('messages', data, {}, 'POST'));
File "/usr/local/lib/python2.7/dist-packages/clickatell/init.py", line 45, in parseResponse
response['error'] = response['body']['error']
KeyError: 'error'

@hobbes
Copy link

hobbes commented Dec 7, 2022

exact same behaviour here with python 3.10. Please update that library !!

@Support-Symplenormics
Copy link

@hobbes and @ognjen011 I got the same thing and I had to remove line 45 of the clickatell/init.py file.
I think is a typo done by the developer they were meant to get the error from the response['message'] (as response['message']['error']) and not from the response['body']. The reason for this is that the message key contains the error key and not the body it resides in the mesomehow it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants