DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

Now let’s take a look at some examples of using HTTPie.
Example 7-10 shows how to use HTTPie to call a simple
GET request.


Example 7-10 Sample HTTP GET Using HTTPie

Click here to view code image


$ http https://postman-echo.com/get?test=123
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 179
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Aug 2019 05:27:17 GMT
ETag: W/"ed-mB0Pm0M3ExozL3fgwq7UlH9aozQ"
Server: nginx
Vary: Accept-Encoding
set-cookie:
sails.sid=s%3AYCeNAWJG7Kap5wvKPg8HYlZI5SHZoqEf.r7Gi96fe5g7%2FSp0jaJk%2Fa
VRpHZp3Oj5tDxiM8TPZ%2Bpc; Path=/; HttpOnly
{
"args": {
"test": "123"
},
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate",
"host": "postman-echo.com",
"user-agent": "HTTPie/1.0.2",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"url": "https://postman-echo.com/get?
test=123"
}

Python Requests


Requests is a Python module that you can use to send
HTTP requests. It is an easy-to-use library with a lot of
possibilities ranging from passing parameters in URLs to
sending custom headers and SSL verification. The
Requests library is a very handy tool you can use
whenever you programmatically start using any APIs.

Free download pdf