question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

i’ve installed httpie on windows through pip. I want to use it through cygwin but it only works through powershell or cmd. I always get the error

Philipp@lupimi ~ $ http POST http://localhost:50231/api/Contact name=scott age:=100
usage: http-script.py [--json] [--form] [--pretty {all,colors,format,none}]
                      [--style STYLE] [--print WHAT] [--headers] [--body]
                      [--verbose] [--all] [--print-others 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] [--debug]
                      [METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http-script.py: error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.

is there anything i can provide?

regards

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jakubroztocilcommented, Mar 26, 2016

@celevra It looks like stdin under Cygwin doesn’t present itself like a TTY so HTTPie thinks it’s redirected from another program or a file. So it’s probably a bug in Cygwin. What output does this command give you?

$ python -c 'import sys; print(sys.stdin.isatty())'

As a workaround, you could use the --ignore-stdin flag. And for convenience, it can be added it to your ~/.httpie/config.json under "default_options": ["--ignore-stdin"]. Then to enable the reading of stdin when you need it for particular invocations, it is possible to disable the flag again via --no-ignore-stdin.

1reaction
Arnie97commented, May 28, 2016

Python for windows is a windows console application, so it won’t work well in msys/cygwin’s ansi terminal.

You may use python for cygwin rather than python for windows,

$ apt-cyg install python
$ python -c 'import sys; print(sys.stdin.isatty())' # => True

Or, you may run python for windows with winpty:

$ python.exe -c 'import sys; print(sys.stdin.isatty())' # => False
$ winpty python.exe -c 'import sys; print(sys.stdin.isatty())' # => True
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cygwin Package Listing
Cygwin · httpie-src: Command-line HTTP client for web services (source).
Read more >
install HTTPie on babun or cygwin - Matthieu Brouillard
As I always forget how to do it on windows using babun or cygwin, I'll push here the steps I followed in order...
Read more >
HTTPie for Terminal - GitHub
HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible.
Read more >
Executing code with http client on windows - ProcessWire
I tried httpie and wget on windows but both do not accept the command ... Thanks for that hint Charles, I downloaded and...
Read more >
HTTPie doesn't honor –style colors in mintty/cygwin - Bit Armory Blog
HTTPie doesn't honor –style colors in mintty/cygwin. less than 1 minute read, May 10, 2013. Be sure to check our $TERM variable.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found