httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.22k stars 3.67k forks source link

URLs with a username but without a password (http user@example.org) cause TypeError #242

Closed victorhooi closed 10 years ago

victorhooi commented 10 years ago

I'm trying to make a GET request against the Flowdock Streaming API (https://www.flowdock.com/api/streaming). I'm using httpie 0.8.0.

I have the following which works in Curl (I've mangled the token starting with "51cd" slightly to sanitise it):

bash-3.2$ curl  https://51cdb547dsd12323sdfsf236de61bcb9121f8d2@stream.flowdock.com/flows/mycompany/victor_testflow

However, when I try with httpie, I get:

bash-3.2$ http GET  https://51cdb547dsd12323sdfsf236de61bcb9121f8d2@stream.flowdock.com/flows/mycompany/victor_testflow

http: error: TypeError: sequence item 1: expected string, NoneType found
bash-3.2$ http GET "https://51cdb547dsd12323sdfsf236de61bcb9121f8d2@stream.flowdock.com/flows/mycompany/victor_testflow"

http: error: TypeError: sequence item 1: expected string, NoneType found

Any thoughts?

jkbrzt commented 10 years ago

It's a bug.

Minimal example:

$ http  --traceback username@example.org
Traceback (most recent call last):
  File "/usr/local/Cellar/httpie/HEAD/libexec/bin/http", line 8, in <module>
    load_entry_point('httpie==0.9.0-dev', 'console_scripts', 'http')()
  File "build/bdist.macosx-10.9-intel/egg/httpie/core.py", line 101, in main
  File "build/bdist.macosx-10.9-intel/egg/httpie/input.py", line 147, in parse_args
  File "build/bdist.macosx-10.9-intel/egg/httpie/input.py", line 219, in _process_auth
TypeError: sequence item 1: expected string or Unicode, NoneType found

The problem is that HTTPie doesn't expect username in the URL without password (here).

jkbrzt commented 10 years ago

It should be fixed in current master. Let me know if it works for you:

https://github.com/jakubroztocil/httpie#development-version