An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Using http-prompt version 0.10.2 under Python 2.7, an AttributeError occurs as soon as a stored cookie is updated. The error doesn't seem to depend on the operating system. Tested on Windows 10 (native and with Cygwin) and with Arch Linux.
To reproduce:
Open any site that stores a cookie, e.g.: http-prompt https://www.google.com --follow
Make a GET request. If http-prompt is configured to automatically store cookies, then a cookie will be stored.
Repeat the GET request. An AttributeError occurs, displayed immediately after the response output.
This is the full error message:
AttributeError: 'unicode' object has no attribute 'items'
Parse tree:
<Node called "action" matching "get"> <-- *** We were here. ***
<RegexNode called "_" matching "">
<Node called "method" matching "get">
<RegexNode matching "get">
<RegexNode called "_" matching "">
<Node matching "">
<Node matching "">
<Node matching "">
<RegexNode called "_" matching "">
I managed to locate the precise spot where the error occurs. It is in the function update_cookies(base_value, cookies), which is in the module cli.py. The root cause seems to be that base_value needs to be a string (or None, initially). But under Python 2 the type of base_value is unicode. A solution that works for me is to insert the following two lines at the begin of that function:
if type(base_value) == unicode:
base_value = base_value.encode('utf8')
But this really is not much more than a hackish workaround. I'd like to have it properly fixed.
Using http-prompt version 0.10.2 under Python 2.7, an AttributeError occurs as soon as a stored cookie is updated. The error doesn't seem to depend on the operating system. Tested on Windows 10 (native and with Cygwin) and with Arch Linux.
To reproduce:
http-prompt https://www.google.com --follow
This is the full error message:
I managed to locate the precise spot where the error occurs. It is in the function
update_cookies(base_value, cookies)
, which is in the modulecli.py
. The root cause seems to be that base_value needs to be a string (or None, initially). But under Python 2 the type of base_value is unicode. A solution that works for me is to insert the following two lines at the begin of that function:But this really is not much more than a hackish workaround. I'd like to have it properly fixed.