MCPcopy Index your code
hub / github.com/StackStorm/st2 / get_property

Method get_property

st2client/st2client/models/core.py:266–303  ·  view source on GitHub ↗

Gets a property of a Resource. id_ : Id of the resource property_name: Name of the property self_deserialize: #Implies use the deserialize method implemented by this resource.

(self, id_, property_name, self_deserialize=True, **kwargs)

Source from the content-addressed store, hash-verified

264
265 @add_auth_token_to_kwargs_from_env
266 def get_property(self, id_, property_name, self_deserialize=True, **kwargs):
267 """
268 Gets a property of a Resource.
269 id_ : Id of the resource
270 property_name: Name of the property
271 self_deserialize: #Implies use the deserialize method implemented by this resource.
272 """
273 token = kwargs.pop("token", None)
274 api_key = kwargs.pop("api_key", None)
275
276 if kwargs:
277 url = "/%s/%s/%s/?%s" % (
278 self.resource.get_url_path_name(),
279 id_,
280 property_name,
281 urllib.parse.urlencode(kwargs),
282 )
283 else:
284 url = "/%s/%s/%s/" % (self.resource.get_url_path_name(), id_, property_name)
285
286 if token:
287 response = self.client.get(url, token=token)
288 elif api_key:
289 response = self.client.get(url, api_key=api_key)
290 else:
291 response = self.client.get(url)
292
293 if response.status_code == http_client.NOT_FOUND:
294 return None
295 if response.status_code != http_client.OK:
296 self.handle_error(response)
297
298 if self_deserialize:
299 return [
300 self.resource.deserialize(item) for item in parse_api_response(response)
301 ]
302 else:
303 return parse_api_response(response)
304
305 @add_auth_token_to_kwargs_from_env
306 def get_by_ref_or_id(self, ref_or_id, **kwargs):

Calls 6

handle_errorMethod · 0.95
parse_api_responseFunction · 0.85
get_url_path_nameMethod · 0.80
deserializeMethod · 0.80
popMethod · 0.45
getMethod · 0.45