xml requests --- requests transmission requests --- requests transmission data type Data type json

  On a brief introduction of the post of four kinds of common data types, today we learn together send xml data type requests

xml data type

Under the data to xml data, we will pass this data to learn if sending xml data type requests, do not know xml data types can click on ( Requests --- Requests to send json data type )

<? Xml Version = "1.0" encoding = "UTF-8" ?> 
< Note > 
  < to > quiet </ to > 
  < from > blog </ from > 
  < heading > Test </ heading > 
  < body > Point followers it </ body > 
</ note >

 

Xml data transmission type

1, import requests library

2, transmission data type xml

3, view the data returned content

After being given a discovery request to see the error prompt to send the required encode, that is, we often say that the encoding format errors

After continue to send by post-encode, to be successful, our data also requested data on it.

 Add xml file

We find that the above method is very beautiful, and write xml code feeling confused and do not highlight the talent of our test engineers, most notably after use cases if many things, so it looks a lot of trouble

We can put xml content written to a file (can be txt, xml can also be a form), then by reading this document

When a request is sent again to see the same return values ​​and our above request, so that our future interfaces alternative, also contribute to the maintenance

 

 

White test summary learn everyday, badly written, please bigwigs do not spray. Feeling quiet blog to help you, you can order a concern, continue to update ~ ~ ~

Guess you like

Origin www.cnblogs.com/qican/p/11401580.html