As the title says, httpie was convenient, so I wondered if it could be used from windows git-bash.
Throw away curl and use httpie-Qiita http://qiita.com/yuku_t/items/5df06d50c4c349cc0c1b
First, install windows python (2.7 here) normally
Python Releases for Windows | Python.org https://www.python.org/downloads/windows/ Download Windows x86-64 MSI installer
Then pass the Path
pip and ipython installation guide (Windows) --secretbase.log http://cointoss.hatenablog.com/entry/20120531/1338474875
Reboot
Then, from git-bash
[12-14 18:22:36 ~]$ python --version
Python 2.7.13rc1
[12-14 18:22:37 ~]$ pip --version
pip 9.0.1 from c:\python27\lib\site-packages (python 2.7)
[12-14 18:22:41 ~]$ easy_install --version
setuptools 31.0.0 from c:\python27\lib\site-packages (Python 2.7)
[12-14 18:22:46 ~]$
Will be available.
Then install httpie
[12-14 18:17:08 ~]$ winpty pip install httpie
Collecting httpie
Using cached httpie-0.9.9-py2.py3-none-any.whl
Requirement already satisfied: colorama>=0.2.4; sys_platform ==
"win32" in c:\python27\lib\site-packages (from httpie)
Requirement already satisfied: requests>=2.11.0 in
c:\python27\lib\site-packages (from httpie)
Requirement already satisfied: Pygments>=2.1.3 in
c:\python27\lib\site-packages (from httpie)
Installing collected packages: httpie
Successfully installed httpie-0.9.9
[12-14 18:19:24 ~]$
Run
[12-14 18:19:25 ~]$ winpty http https://www.google.co.jp/
HTTP/1.1 200 OK
Alt-Svc: quic=":443"; ma=2592000; v="35,34"
Cache-Control: private, max-age=0
Content-Encoding: gzip
Content-Type: text/html; charset=Shift_JIS
Date: Wed, 14 Dec 2016 09:19:30 GMT
...
Convenient!
What to do if Python doesn't work on Git for Windows-Qiita http://qiita.com/icoxfog417/items/33e6b1f3dd9358923e21
It seems that. Tweak the script or Let's do it quietly with winpty in mind.
If you write the execution result of httpie to text from git-bash,
$ winpty http GET http://127.0.0.1/search/song word==ai count==5 --print hb --pretty format --output result.txt
If you want to do something like
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: error: Only terminal output can be colorized on Windows.
It will be. To solve this problem, use cmd.exe instead of git-bash
C:\Users\XXXX> http GET http://127.0.0.1/search/song word==ai count==5 --print hb --pretty format --output result.txt
Then you can write the output in the formatted state. Note that you don't need winpty.
Recommended Posts