requests接口自动化8-传递数据为xml形式的post请求:data

传递数据为xml形式的post请求

请求体内容:



pcx
123456
absbnmasbnfmasbm1213


  

代码:

import requests
#请求内容为xml的post请求
url = "http://httpbin.org/post"
# python3字符串换行,在右边加个反斜杠
body = '' \
        '' \
        '' \
       'pcx' \
        '123456' \
        'absbnmasbnfmasbm1213' \
        '' \
        ''

response = s.post(url, data=body.encode("utf-8"),verify=False)
print(response.text)

 运行结果:

requests接口自动化8-传递数据为xml形式的post请求:data_第1张图片

 

你可能感兴趣的:(requests接口自动化8-传递数据为xml形式的post请求:data)