def formatBizQueryParaMap(self, paraMap, urlencode): """格式化参数,签名过程需要使用""" slist = sorted(paraMap) buff = [] for k in slist: v = quote(paraMap[k]) if urlencode else paraMap[k] buff.append("{0}={1}".format(k, smart_str(v))) return "&".join(buff)
def arrayToXml(self, arr): """array转xml""" xml = ["<xml>"] for k, v in arr.iteritems(): if v.isdigit(): xml.append("<{0}>{1}</{0}>".format(k, v)) else: xml.append("<{0}><![CDATA[{1}]]></{0}>".format(k, smart_str(v))) xml.append("</xml>") return "".join(xml)
def arrayToXml(self, arr): """array转xml""" xml = ["<xml>"] for k, v in arr.iteritems(): if v.isdigit(): xml.append("<{0}>{1}</{0}>".format(k, v)) else: xml.append("<{0}><![CDATA[{1}]]></{0}>".format( k, smart_str(v))) xml.append("</xml>") return "".join(xml)