- Django RESTful Web Services
- Gaston C. Hillar
- 307字
- 2021-06-30 19:30:56
Installing HTTPie
Now, we will install HTTPie, a command-line HTTP client written in Python that makes it easy to send HTTP requests and uses a syntax that is easier than curl. By default, HTTPie displays colorized output and uses multiple lines to display the response details. In some cases, HTTPie makes it easier to understand the responses than the curl utility. However, one of the great disadvantages of HTTPie as a command-line utility is that it takes more time to load than curl, and therefore, if you want to code scripts with too many commands, you have to evaluate whether it makes sense to use HTTPie.
We just need to make sure we run the following command in the virtual environment we have just created and activated. This way, we will install HTTPie only for our virtual environment.
Run the following command in the terminal, Command Prompt, or Windows PowerShell to install the httpie package:
pip install --upgrade httpie
The last lines of the output will indicate that the httpie package has been successfully installed:
Collecting httpie Collecting colorama>=0.2.4 (from httpie) Collecting requests>=2.11.0 (from httpie) Collecting Pygments>=2.1.3 (from httpie) Collecting idna<2.7,>=2.5 (from requests>=2.11.0->httpie) Collecting urllib3<1.23,>=1.21.1 (from requests>=2.11.0->httpie) Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.11.0->httpie) Collecting certifi>=2017.4.17 (from requests>=2.11.0->httpie) Installing collected packages: colorama, idna, urllib3, chardet, certifi, requests, Pygments, httpie Successfully installed Pygments-2.2.0 certifi-2017.7.27.1 chardet-3.0.4 colorama-0.3.9 httpie-0.9.9 idna-2.6 requests-2.18.4 urllib3-1.22
Now, we will be able to use the http command to easily compose and send HTTP requests to our future RESTful Web Services build with Django. The following screenshot shows the results of executing http on Command Prompt in Windows 10. HTTPie displays the valid options and indicates that a URL is required:

- C++面向對象程序設計(第三版)
- iOS面試一戰到底
- 高手是如何做產品設計的(全2冊)
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- Functional Programming in JavaScript
- Mastering Python High Performance
- Mastering AndEngine Game Development
- 零基礎學Python數據分析(升級版)
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- C語言程序設計
- INSTANT Silverlight 5 Animation
- SQL Server 2016 從入門到實戰(視頻教學版)
- Tableau Desktop可視化高級應用
- 交互設計師成長手冊:從零開始學交互
- 零基礎學編程系列(全5冊)