httpie / http-prompt

An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie

Home Page:https://http-prompt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

problem with passing args to httpie

mike386 opened this issue · comments

commented

Hi there!

For some time I could not start using the program with --session option because of the following error:

http-prompt httpbin.org --session example
Version: 1.0.0
http://httpbin.org> get /

--session: error: ConnectionError: HTTPConnectionPool(host='get', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at >: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) while doing a EXAMPLE request to URL: http://get/

The --session substring is ignored but example is treated as it was an HTTP verb. Today I was able to work around this problem by changing execution.py as follows:

*** execution.py.bak	2020-03-10 14:34:53.120833943 +0300
--- execution.py	2020-03-10 14:29:57.475301371 +0300
***************
*** 503,509 ****
          # interested in.
          sys.settrace(self._trace_get_response)
          try:
!             httpie_main(args, env=env)
          finally:
              sys.settrace(None)
  
--- 503,509 ----
          # interested in.
          sys.settrace(self._trace_get_response)
          try:
!             httpie_main([""] + args, env=env)
          finally:
              sys.settrace(None)

It seems to me that httpie wants arguments as sys.argv provides them (with zero item as program name), but http-prompt passes them in another way (without such item).

I'm not sending this as a PR because this is obviously just a workaround.

Please let me know if any additional info is needed.

This should be fixed in master. v2.0.0 will be released soon.

You install & test it via the following command:

pip install -U https://github.com/httpie/http-prompt/archive/master.zip