You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/13 09:33:47 UTC

[41/46] libcloud git commit: fix python 2 aliyun XML decoding issue for responses with unicode charsets, see #994

fix python 2 aliyun XML decoding issue for responses with unicode charsets, see #994


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9039a088
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9039a088
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9039a088

Branch: refs/heads/trunk
Commit: 9039a088c7dbe5790fa1bba8e2c00dc168db3095
Parents: 014b10f
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Apr 13 14:22:49 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Apr 13 14:22:49 2017 +1000

----------------------------------------------------------------------
 libcloud/common/aliyun.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9039a088/libcloud/common/aliyun.py
----------------------------------------------------------------------
diff --git a/libcloud/common/aliyun.py b/libcloud/common/aliyun.py
index 4e4b5a4..d500416 100644
--- a/libcloud/common/aliyun.py
+++ b/libcloud/common/aliyun.py
@@ -64,7 +64,10 @@ class AliyunXmlResponse(XmlResponse):
                 parser = ET.XMLParser(encoding='utf-8')
                 body = ET.XML(self.body.encode('utf-8'), parser=parser)
             else:
-                body = ET.XML(self.body)
+                try:
+                    body = ET.XML(self.body)
+                except ValueError:
+                    body = ET.XML(self.body.encode('utf-8'))
         except:
             raise MalformedResponseError('Failed to parse XML',
                                          body=self.body,