diff --git a/dyn/core.py b/dyn/core.py index 0e12036..a9c99d2 100644 --- a/dyn/core.py +++ b/dyn/core.py @@ -264,7 +264,7 @@ def _retry(self, msgs, final=False): # Get the task id task = next(pat.match(i['INFO']).group(1) for i in msgs if pat.match(i.get('INFO', ''))) - except: + except Exception: # Task id could not be recovered wait = 1 else: diff --git a/dyn/tm/services/dsf.py b/dyn/tm/services/dsf.py index 0022d8a..c926fe6 100644 --- a/dyn/tm/services/dsf.py +++ b/dyn/tm/services/dsf.py @@ -35,6 +35,19 @@ 'TrafficDirector'] +def get_dsf(service): + """ + :param service: a dsf_id string, or :class:`TrafficDirector` + :return: :class:`TrafficDirector` Service + """ + _service_id = _check_type(service) + uri = '/DSF/{}'.format(_service_id) + api_args = {'detail': 'Y'} + response = DynectSession.get_session().execute(uri, 'GET', api_args) + director = TrafficDirector(None, api=False, **response['data']) + return director + + def get_all_dsf_services(): """:return: A ``list`` of :class:`TrafficDirector` Services""" uri = '/DSF/' @@ -419,7 +432,7 @@ def _build(self, data): self._rdata_class.lower()): for k, v in rdata_v.items(): setattr(self, '_' + k, v) - except: + except Exception: pass else: setattr(self, '_' + key, val)