- 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:

- PHP動態(tài)網(wǎng)站程序設(shè)計
- Flask Web全棧開發(fā)實(shí)戰(zhàn)
- 自然語言處理實(shí)戰(zhàn):預(yù)訓(xùn)練模型應(yīng)用及其產(chǎn)品化
- Ext JS Data-driven Application Design
- Mastering Python Scripting for System Administrators
- Swift 3 New Features
- Mastering Swift 2
- Magento 1.8 Development Cookbook
- HTML5+CSS3網(wǎng)站設(shè)計基礎(chǔ)教程
- Mastering Python Networking
- 琢石成器:Windows環(huán)境下32位匯編語言程序設(shè)計
- 大模型RAG實(shí)戰(zhàn):RAG原理、應(yīng)用與系統(tǒng)構(gòu)建
- HTML5+CSS3+jQuery Mobile APP與移動網(wǎng)站設(shè)計從入門到精通
- QGIS 2 Cookbook
- Django Design Patterns and Best Practices