dyninc / dyn-python

Dyn SDK for Python
Other
36 stars 52 forks source link

DSFNotifier Object Throws Exception when to_json() #138

Closed weichuliu closed 3 years ago

weichuliu commented 5 years ago

Error bumped out when I did notifier.to_json():

In [32]: all_notifiers[0].to_json()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-32-3f295e19ee74> in <module>
----> 1 all_notifiers[0].to_json()

~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dyn/tm/services/dsf.py in to_json(self)
   3533         if self._recipients:
   3534             json_blob['recipients'] = [recipient['recipient'] for recipient in
-> 3535                                        self._recipients]
   3536         if self._services:
   3537             json_blob['dsf_services'] = [dsf['service_id'] for dsf in

~/.pyenv/versions/3.6.2/lib/python3.6/site-packages/dyn/tm/services/dsf.py in <listcomp>(.0)
   3532             json_blob['label'] = self._label
   3533         if self._recipients:
-> 3534             json_blob['recipients'] = [recipient['recipient'] for recipient in
   3535                                        self._recipients]
   3536         if self._services:

Turns out it's already a list.

In [52]: x._recipients
Out[52]: ['somebody']