변군이글루

[명령어] httpie 명령어 본문

* 리눅스

[명령어] httpie 명령어

변군 변군이글루 2021. 7. 27. 16:05
728x90

httpie 명령어

pip 설치

python 버전 확인

$ python --version
Python 2.7.5

pip 설치

$ wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

$ python get-pip.py
---output---
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 1.7 MB/s
Collecting setuptools<45
  Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
     |████████████████████████████████| 583 kB 34.8 MB/s
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.3.4 setuptools-44.1.1 wheel-0.36.2

$ which pip
/bin/pip

httpie 설치

$ pip install --upgrade httpie
---output---
Collecting httpie
  Downloading httpie-1.0.3-py2.py3-none-any.whl (59 kB)
     |████████████████████████████████| 59 kB 871 kB/s
Collecting Pygments>=2.3.1
  Downloading Pygments-2.5.2-py2.py3-none-any.whl (896 kB)
     |████████████████████████████████| 896 kB 2.7 MB/s
Collecting requests>=2.21.0
  Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)
     |████████████████████████████████| 62 kB 261 kB/s
Collecting certifi>=2017.4.17
  Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 11.9 MB/s
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
     |████████████████████████████████| 138 kB 11.7 MB/s
Collecting idna<3,>=2.5; python_version < "3"
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 2.0 MB/s
Collecting chardet<5,>=3.0.2; python_version < "3"
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 11.3 MB/s
Installing collected packages: Pygments, certifi, urllib3, idna, chardet, requests, httpie
  Attempting uninstall: chardet
    Found existing installation: chardet 2.2.1
    Uninstalling chardet-2.2.1:
      Successfully uninstalled chardet-2.2.1
Successfully installed Pygments-2.5.2 certifi-2021.5.30 chardet-4.0.0 httpie-1.0.3 idna-2.10 requests-2.26.0 urllib3-1.26.6

기본 사용

$ http
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
            [--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
            [--all] [--history-print WHAT] [--stream] [--output FILE]
            [--download] [--continue]
            [--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
            [--auth USER[:PASS]] [--auth-type {basic,digest}]
            [--proxy PROTOCOL:PROXY_URL] [--follow]
            [--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
            [--check-status] [--verify VERIFY]
            [--ssl {ssl2.3,ssl3,tls1,tls1.1,tls1.2}] [--cert CERT]
            [--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version]
            [--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
            [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]

$ http -v --follow sangchul.kr
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: sangchul.kr
User-Agent: HTTPie/1.0.3



HTTP/1.1 302 Found
Cache-Control: no-cache
Content-length: 0
Location: https://sangchul.kr/



GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: sangchul.kr
User-Agent: HTTPie/1.0.3



HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://sangchul.kr
Content-Encoding: gzip
Content-Length: 11771
Content-Type: text/html; charset=utf-8
Date: Tue, 27 Jul 2021 07:02:49 GMT
P3P: CP='ALL DSP COR MON LAW OUR LEG DEL'
Vary: Accept-Encoding
X-UA-Compatible: IE=Edge

<!doctype html>
<html lang="ko">
...

 

https://github.com/httpie/httpie

728x90
0 Comments
댓글쓰기 폼