demo.py 2.13 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/9/8 16:23
# @Author  : Ljq
# @File    : demo.py
# @Software: PyCharm

"""

"""

import requests
import xml.dom.minidom

url = "http://10.28.1.155:6789"

payload = """<?xml version="1.0" encoding="GBK"?>
<stream>
    <action>DLBALQRY</action>
    <userName>11100165758310248856</userName>
    <list name="userDataList">
        <row>
            <accountNo>8113101013600080147</accountNo>
        </row>
    </list>
</stream>"""

searchLoad = """<?xml version="1.0" encoding="GBK"?>
<stream>
    <action>DLCIDSTT</action>
    <userName>11100165758310248856</userName>
    <clientID>1195178300421038080</clientID>
    <type></type>
    <controlFlag>1</controlFlag>
</stream>"""

do_pay = """<?xml version="1.0" encoding="GBK"?>
<stream>
    <action>DLINTTRN</action>
    <userName>11100165758310248856</userName>
    <list name="userDataList">
        <row>
            <clientID>1195236505817833472</clientID>
            <preFlg>0</preFlg>
            <preDate></preDate>
            <preTime></preTime>
            <payType>2</payType>
            <payFlg>1</payFlg>
            <payAccountNo>8113101013600080147</payAccountNo>
            <recAccountNo>6217690700023561</recAccountNo>
            <recAccountName>慈伪化</recAccountName>
            <recOpenBankName>中信银行北京安贞支行</recOpenBankName>
            <recOpenBankCode>302100011309</recOpenBankCode>
            <tranAmount>2.20</tranAmount>
            <abstract>Online bank withdraw</abstract>
            <memo>Online bank withdraw</memo>
            <chkNum>20210914</chkNum>
        </row>
    </list>
</stream>"""

headers = {
  'Content-Type': 'application/xml'
}

# # 余额
# print(payload)
# response = requests.request("POST", url, headers=headers, data=payload)

# 订单状态
print(searchLoad)
response = requests.request("POST", url, headers=headers, data=searchLoad)

# # 缴费
# print(do_pay)
# response = requests.request("POST", url, headers=headers, data=do_pay.encode("gbk"))

a = response.content.decode("gbk")
xml = xml.dom.minidom.parseString(a)
print("------------------------------------------------")
print(xml.toprettyxml())