meraki / spark-operations-bot

bot leveraging the Spark Bot framework
MIT License
13 stars 9 forks source link

TypeError: string indices must be integers #12

Closed bit-git closed 5 years ago

bit-git commented 6 years ago

Hi,

Getting TypeError, my guess is that this could be because there are no phones in the network. Is it possible to add code to check if no phones then continue or return 0. Sorry, I am not very good at coding.

Found command: health Meraki Support Enabled Spark Call Support Enabled Error. Server returned '401 - Unauthorized [2018-03-30 11:25:13,451] ERROR in app: Exception on / [POST] Traceback (most recent call last): File "/home/omz/.local/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/home/omz/.local/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/omz/.local/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/omz/.local/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/omz/.local/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/home/omz/.local/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/home/omz/.local/lib/python3.5/site-packages/ciscosparkbot/Spark.py", line 184, in process_incoming_message reply = self.commands[command]"callback" File "/home/omz/spark_bot/spark-operations-bot-master/cico_combined.py", line 43, in get_health retval += cico_spark_call.get_spark_call_health(incoming_msg, "html") File "/home/omz/spark_bot/spark-operations-bot-master/cico_spark_call.py", line 278, in get_spark_call_health retmsg += "" + str(spark_data["Total"]["offline"]) + " phone(s) offline out of a total of " + str(spark_data["Total"]["num"]) + " phone(s)." TypeError: string indices must be integers 127.0.0.1 - - [30/Mar/2018 11:25:13] "POST / HTTP/1.1" 500 -

joshand commented 5 years ago

I believe this is resolved - if not, please let me know!