File size: 938 Bytes
8247f19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/weixin/msg.py b/weixin/msg.py
index cb4e74a..89806b0 100644
--- a/weixin/msg.py
+++ b/weixin/msg.py
@@ -64,7 +64,8 @@ class WeixinMsg(object):
 
     def parse(self, content):
         raw = {}
-        root = etree.fromstring(content)
+        root = etree.fromstring(content,
+                                parser=etree.XMLParser(resolve_entities=False))
         for child in root:
             raw[child.tag] = child.text
 
diff --git a/weixin/pay.py b/weixin/pay.py
index 4ab8cfb..1f8e231 100644
--- a/weixin/pay.py
+++ b/weixin/pay.py
@@ -79,7 +79,8 @@ class WeixinPay(object):
 
     def to_dict(self, content):
         raw = {}
-        root = etree.fromstring(content.encode("utf-8"))
+        root = etree.fromstring(content.encode("utf-8"),
+                                parser=etree.XMLParser(resolve_entities=False))
         for child in root:
             raw[child.tag] = child.text
         return raw