Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_MinidomXmlToObject._fill_dict_of(
node,
_get_serialization_name(name),
value.pair_xml_element_name,
value.key_xml_element_name,
value.value_xml_element_name))
elif isinstance(value, _xml_attribute):
real_value = None
if node.hasAttribute(value.xml_element_name):
real_value = node.getAttribute(value.xml_element_name)
if real_value is not None:
setattr(return_obj, name, real_value)
elif isinstance(value, WindowsAzureData):
setattr(return_obj,
name,
_MinidomXmlToObject._fill_instance_child(
node,
name,
value.__class__))
elif isinstance(value, dict):
setattr(return_obj,
name,
_MinidomXmlToObject._fill_dict(
node,
_get_serialization_name(name)))
elif isinstance(value, _Base64String):
value = _MinidomXmlToObject.fill_data_member(
node,
name,
'')
if value is not None:
value = _decode_base64_to_text(value)
def _perform_post(self, path, body, response_type=None, as_async=False,
x_ms_version=None):
response = self.perform_post(path, body, x_ms_version)
if response_type is not None:
return _MinidomXmlToObject.parse_response(response, response_type)
if as_async:
return parse_response_for_async_op(response)
return None
@staticmethod
def _find_namespaces_from_child(parent, child, namespaces):
"""Recursively searches from the parent to the child,
gathering all the applicable namespaces along the way"""
for cur_child in parent.childNodes:
if cur_child is child:
return True
if _MinidomXmlToObject._find_namespaces_from_child(cur_child, child, namespaces):
# we are the parent node
for key in cur_child.attributes.keys():
if key.startswith('xmlns:') or key == 'xmlns':
namespaces[key] = cur_child.attributes[key]
break
return False
def _perform_post(self, path, body, response_type=None, as_async=False,
x_ms_version=None):
response = self.perform_post(path, body, x_ms_version)
if response_type is not None:
return _MinidomXmlToObject.parse_response(response, response_type)
if as_async:
return parse_response_for_async_op(response)
return None
@staticmethod
def convert_response_to_feeds(response, convert_func):
if response is None:
return None
feeds = _list_of(Feed)
_set_continuation_from_response_headers(feeds, response)
xmldoc = minidom.parseString(response.body)
xml_entries = _MinidomXmlToObject.get_children_from_path(xmldoc, 'feed', 'entry')
if not xml_entries:
# in some cases, response contains only entry but no feed
xml_entries = _MinidomXmlToObject.get_children_from_path(xmldoc, 'entry')
for xml_entry in xml_entries:
new_node = _MinidomXmlToObject._clone_node_with_namespaces(xml_entry, xmldoc)
feeds.append(convert_func(new_node.toxml('utf-8')))
return feeds
specified scalar type and added to the list.
Example:
xmldoc=
http://{storage-service-name}.blob.core.windows.net/
http://{storage-service-name}.queue.core.windows.net/
http://{storage-service-name}.table.core.windows.net/
element_type=str
parent_xml_element_name='Endpoints'
xml_element_name='Endpoint'
'''
xmlelements = _MinidomXmlToObject.get_child_nodes(xmldoc, parent_xml_element_name)
if xmlelements:
xmlelements = _MinidomXmlToObject.get_child_nodes(xmlelements[0], xml_element_name)
return [_MinidomXmlToObject._get_node_value(xmlelement, element_type) \
for xmlelement in xmlelements]
@staticmethod
def _fill_data_to_return_object(node, return_obj):
members = dict(vars(return_obj))
for name, value in members.items():
if isinstance(value, _list_of):
setattr(return_obj,
name,
_MinidomXmlToObject._fill_list_of(
node,
value.list_type,
value.xml_element_name))
elif isinstance(value, _scalar_list_of):
setattr(return_obj,
name,
_MinidomXmlToObject._fill_scalar_list_of(
node,
value.list_type,
_get_serialization_name(name),
value.xml_element_name))
elif isinstance(value, _dict_of):
setattr(return_obj,
name,
_MinidomXmlToObject._fill_dict_of(
node,
def _perform_get(self, path, response_type=None, x_ms_version=None):
response = self.perform_get(path, x_ms_version)
if response_type is not None:
return _MinidomXmlToObject.parse_response(response, response_type)
return response
def _perform_get(self, path, response_type=None, x_ms_version=None):
response = self.perform_get(path, x_ms_version)
if response_type is not None:
return _MinidomXmlToObject.parse_response(response, response_type)
return response