projects
/
osm
/
osmclient.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(from parent 1:
cabaf77
)
Merge "Add get_field method"
author
Michael Marchetti
<mmarchetti@sandvine.com>
Wed, 31 Oct 2018 16:19:15 +0000
(17:19 +0100)
committer
Gerrit Code Review
<root@osm.etsi.org>
Wed, 31 Oct 2018 16:19:15 +0000
(17:19 +0100)
osmclient/sol005/ns.py
patch
|
blob
|
history
diff --git
a/osmclient/sol005/ns.py
b/osmclient/sol005/ns.py
index
58be4e4
..
387bcd5
100644
(file)
--- a/
osmclient/sol005/ns.py
+++ b/
osmclient/sol005/ns.py
@@
-168,7
+168,7
@@
class Ns(object):
if not resp or 'id' not in resp:
raise ClientException('unexpected response from server - {} '.format(
resp))
- print(resp['id'])
+ return resp['id']
else:
msg = ""
if resp:
@@
-368,3
+368,12
@@
class Ns(object):
exc.message)
raise ClientException(message)
+ def get_field(self, ns_name, field):
+ nsr = self.get(ns_name)
+ if nsr is None:
+ raise NotFound("failed to retrieve ns {}".format(ns_name))
+
+ if field in nsr:
+ return nsr[field]
+
+ raise NotFound("failed to find {} in ns {}".format(field, ns_name))