In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail the "HTTP toolkit HTTPie how to use", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use the HTTP toolkit HTTPie" can help you solve your doubts.
HTTPie is a command-line client designed for testing, debugging, and typically interacting with API and HTTP servers. The http and https commands allow you to create and send arbitrary HTTP requests. They use simple and natural syntax and provide formatting and color output.
What is the interface?
To give an example of a simple image, if there is a pet store that sells animal food, such as cat food and dog food, then selling food is an interface. Cats sell cat food and dogs sell dog food. In the future, you just need to modify this method of selling food.
If there is no interface, then it is necessary to write down what to do to cats, what to do to dogs, and what to do to chickens, ducks and fish in the future. In short, the interface makes the program easy to change.
Why debug the interface?
The ultimate goal is to make the interface stable without bug. Generally speaking, in addition to the most basic normal use functions, you also need to test the critical situation, such as whether the data on the boundary of the input data range can be processed, and the performance test, which is the use of resources. interface response time and so on.
About Httpie
Features: 1. Intuitive syntax 2, formatted and colored terminal output 3, built-in JSON support 4, support for uploading forms and files 5, HTTPS, proxy and authentication support 6, support for arbitrary request data 7, custom title 8, persistent session 9, class Wget download 10, support for Python 2.6,2.7 and 3.x 11, support for Linux, Mac OS X and Windows 12, plug-ins 13, document 14, test coverage
Curl VS Httpie
Let's first compare Httpie with curl with a diagram:
How to use curl curl-X METHOD-H HEADER-I
The following-I indicates the header that displays the return message. If you use cURL to access OpenStack, this option is necessary to get a token of type UUID. Then create the request message body, and when you use curl to send the message, you will return the json message body, but the returned json message body is messy and inconvenient to read, so it is difficult to get some information from the returned json message body.
How to use Httpie
HTTPie is written based on python and internally uses the Requests and Pygments libraries.
The use of HTTPie is much more intuitive than cURL, there are not so many options, basically you can write whatever you want, and the default input and output are in json format (while cURL must specify-H "Content-Type: application/json"). We also implement the function of obtaining token above, and the effect is as follows:
It is obvious that the structure of the result obtained by using Httpie is clear, and it automatically highlights and formats the returned result.
After reading this, the article "how to use the HTTP toolkit HTTPie" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself to understand it. If you want to know more about the article, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.