Code Monkey home page Code Monkey logo

httpie / httpie Goto Github PK

View Code? Open in Web Editor NEW
31.5K 84.0 3.6K 6.73 MB

πŸ₯§ HTTPie CLI β€” modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.

Home Page: https://httpie.io

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.07% Shell 1.23% Python 92.40% Roff 5.11% Dockerfile 0.19%
http cli client terminal web json development rest debugging python usability httpie developer-tools http-client curl devops api api-client rest-api api-testing

httpie's Introduction

HTTPie
HTTPie CLI: human-friendly HTTP client for the API era

HTTPie for Desktop Twitter Chat

Docs Latest version Build Coverage PyPi downloads

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. HTTPie is designed for testing, debugging, and generally interacting with APIs & HTTP servers. The http & https commands allow for creating and sending arbitrary HTTP requests. They use simple and natural syntax and provide formatted and colorized output.

HTTPie in action

We lost 54k GitHub stars

Please note we recently accidentally made this repo private for a moment, and GitHub deleted our community that took a decade to build. Read the full story here: https://httpie.io/blog/stardust

Getting started

Features

  • Expressive and intuitive syntax
  • Formatted and colorized terminal output
  • Built-in JSON support
  • Forms and file uploads
  • HTTPS, proxies, and authentication
  • Arbitrary request data
  • Custom headers
  • Persistent sessions
  • wget-like downloads

See all features β†’

Examples

Hello World:

https httpie.io/hello

Custom HTTP method, HTTP headers and JSON data:

http PUT pie.dev/put X-API-Token:123 name=John

Build and print a request without sending it using offline mode:

http --offline pie.dev/post hello=offline

Use GitHub API to post a comment on an Issue with authentication:

http -a USERNAME POST https://api.github.com/repos/httpie/cli/issues/83/comments body='HTTPie is awesome! :heart:'

See more examples β†’

Community & support

Contributing

Have a look through existing Issues and Pull Requests that you could help with. If you'd like to request a feature or report a bug, please create a GitHub Issue using one of the templates provided.

See contribution guide β†’

httpie's People

Contributors

a1346054 avatar bobotig avatar dair-targ avatar dependabot[bot] avatar dsego avatar duboviy avatar efyang avatar faulkner avatar flashingpumpkin avatar frewsxcv avatar github-actions[bot] avatar hroncok avatar hugo-sid avatar ii-v avatar isidentical avatar jakubroztocil avatar janbrasna avatar jkbrzt avatar laurentb avatar matthew16550 avatar mblayman avatar medecau avatar msabramo avatar nlf avatar ovezovs avatar prafulfillment avatar scorphus avatar timgates42 avatar unsignedint avatar velezbeltran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

httpie's Issues

Output Redirection on Windows

If I try to pipe the output to underscore-cli so I can filter/sort/pluck/map the JSON returned I get the following error:

"Output redirection is not supported on Windows. Please use `--output FILE' instead."

So I use the output switch and feed it a filename then cat the file in the pipeline but I still get the previous error.

Any bash script guys that can help? I would dearly love to be able to run a pipeline with the JSON returned.

Option for Accept header

Fantastic tool - thanks!

It'd be useful if for GETs, the -j/--json option would set Accept:application/json in the same way that it sets Content-Type for PUTs/POSTs.

I know I can add the Accept header myself afterwards and that works fine - I'm just thinking it'd save me some typing as it's something I'd need to add to every GET request otherwise.

Support for cookies?

Is there support for cookies?

The underlying request lib seems to support cookies....

Cheers,

Govinda

Option to show request

It would be nice to have an option to show the generated HTTP request in addition to the response.

remove need for quotes to be escaped for raw json input

While it may be intentional, it is quite unintuitive that you need to escape your quotes for raw json input

$> http POST localhost:8888/api/learn/license_check purchased_licenses:=["android.test.purchased"]
http: error: purchased_licenses:=[android.test.purchased] is not valid JSON

but

$> http POST localhost:8888/api/learn/license_check purchased_licenses:=[\"android.test.purchased\"]
HTTP/1.1 200 OK
...

This is in OSX terminal - 10.7.4.

Installation on Windows fails - bad character in README.rst?

When running setup.py (doesn't matter how) with Python 3.2.3 I get a error. A bad character perhaps in README.rst.

C:\Users\scottha\Desktop\build\httpie>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    long_description=open('README.rst').read(),
  File "C:\Python32\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 15359:
aracter maps to <undefined>

I got past it and installed by commenting out the open.

long_description="", #open('README.rst').read(),

--verbose flag does not work


Traceback (most recent call last):
  File "/usr/local/bin/http", line 9, in <module>
    load_entry_point('httpie==0.2.0', 'console_scripts', 'http')()
  File "/usr/local/lib/python2.7/dist-packages/httpie-0.2.0-py2.7.egg/httpie/__main__.py", line 115, in main
    output = _get_output(args, stdout_isatty, response)
  File "/usr/local/lib/python2.7/dist-packages/httpie-0.2.0-py2.7.egg/httpie/__main__.py", line 89, in _get_output
    message=httpmessage.from_request(response.request),
  File "/usr/local/lib/python2.7/dist-packages/httpie-0.2.0-py2.7.egg/httpie/httpmessage.py", line 28, in from_request
    body=request._enc_data,
AttributeError: 'Request' object has no attribute '_enc_data'

ImportError: No module named pygments

I got this import error when installing on Ubuntu 11.10. Installing pygments first and installing httpie fixed this error.

sudo pip install httpie
[sudo] password for neil: 
Downloading/unpacking httpie
  Downloading httpie-0.1.3.tar.gz
  Running setup.py egg_info for package httpie
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/neil/Desktop/build/httpie/setup.py", line 2, in <module>
        from httpie import httpie
      File "httpie/httpie.py", line 13, in <module>
        from . import pretty
      File "httpie/pretty.py", line 3, in <module>
        import pygments
    ImportError: No module named pygments
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/neil/Desktop/build/httpie/setup.py", line 2, in <module>

    from httpie import httpie

  File "httpie/httpie.py", line 13, in <module>

    from . import pretty

  File "httpie/pretty.py", line 3, in <module>

    import pygments

ImportError: No module named pygments

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/neil/.pip/pip.log

--verbose --form error

$> http POST -f -v http://httpbin.org/post hello=world
Traceback (most recent call last):
  File "/usr/local/bin/http", line 9, in <module>
    load_entry_point('httpie==0.2.0', 'console_scripts', 'http')()
  File "/usr/local/lib/python2.7/dist-packages/httpie/__main__.py", line 115, in main
    output = _get_output(args, stdout_isatty, response)
  File "/usr/local/lib/python2.7/dist-packages/httpie/__main__.py", line 92, in _get_output
    with_body=cliparse.OUT_REQ_BODY in args.output_options
  File "/usr/local/lib/python2.7/dist-packages/httpie/httpmessage.py", line 66, in format
    return '\n'.join(bit.strip() for bit in bits)
  File "/usr/local/lib/python2.7/dist-packages/httpie/httpmessage.py", line 66, in <genexpr>
    return '\n'.join(bit.strip() for bit in bits)
AttributeError: 'OrderedDict' object has no attribute 'strip'

Error when install in Ubuntu 12.04

Hello,

I'm trying to install httpie through "pip install -U httpie", and that is what happening:

Downloading/unpacking httpie
  Downloading httpie-0.2.7.tar.gz
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/download.py", line 456, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/util.py", line 494, in unpack_file
  File "/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg/pip/util.py", line 408, in untar_file
    os.makedirs(location)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/lsmagalhaes/build/httpie'
Storing complete log in /home/lsmagalhaes/.pip/pip.log

Any ideas?

httpie output has lots of additional characters on windows

Running http GET httpie.org on windows results in a load of extra characters being printed out:

HTTP/1.1 ←[39;49;00m←[34m302←[39;49;00m←[33m Found←[39;49;00m
Date:←[39;49;00m←[33m Mon, 19 Mar 2012 15:13:17 GMT←[39;49;00m
Server:←[39;49;00m←[33m Apache←[39;49;00m
X-Awesome:←[39;49;00m←[33m Thanks for trying HTTPie :)←[39;49;00m
Location:←[39;49;00m←[33m https://github.com/jkbr/httpie←[39;49;00m
Cache-Control:←[39;49;00m←[33m max-age=1800←[39;49;00m
Expires:←[39;49;00m←[33m Mon, 19 Mar 2012 15:43:17 GMT←[39;49;00m
Content-Length:←[39;49;00m←[33m 214←[39;49;00m
Content-Type:←[39;49;00m←[33m text/html; charset=iso-8859-1←[39;49;00m

←[36m<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">←[39;49;00m
←[34;01m<html←[39;49;00m←[34;01m>←[39;49;00m←[34;01m<head←[39;49;00m←[34;01m>←[39;49;00m
←[34;01m<title←[39;49;00m←[34;01m>←[39;49;00m302 Found←[39;49;00m←[34;01m</title>←[39;49;00m
←[34;01m</head>←[39;49;00m←[34;01m<body←[39;49;00m←[34;01m>←[39;49;00m
←[34;01m<h1←[39;49;00m←[34;01m>←[39;49;00mFound←[39;49;00m←[34;01m</h1>←[39;49;00m
←[34;01m<p←[39;49;00m←[34;01m>←[39;49;00mThe document has moved ←[39;49;00m←[34;01m<a←[39;49;00m ←[39;49;00m←[36mhref=←[39;49;00m←[33m"https://github.com/jkbr/httpie"←[39;49;00m←[34;01m>←[39;49;00mhere←[39;49;00m←[34;01m</a>←[39;49;00m.←[39;49;00m←[34;01m</p>←[39;49;00m

I'm guessing that these are escape codes that provide the colored output on other operating systems. Running http -u GET httpie.org results in correct (though monochrome) output.

It'd be nice to get cross platform colored output like provided by clint.

Syntax for nested JSON

The simple examples work, but what about nested data?
In curl I do something like this:

-d
'"credentials": {
"username": "me",
"key": "my-key"}
}'

How can I do this with httpie?

Broken highlighting

When I attempt GET requests, for example "http GET http://www.ekit.com/" the highlighting ended up broken:

http://dl.dropbox.com/u/7229834/httpie-bad-highlight.gif

Yes, all blinky. The highlighting continued on in the shell and I had to reset the tty to fix it. I got the same result from http://www.google.com/ and others.

I'm using Python 2.6, httpie-0.1.4, requests-0.10.6, Pygments-1.4 in an OS X Terminal.app window. I'm not sure what other information I could provide to help debug this.

UnicodeEncodeError when piping Unicode output

Terminal supports UTF-8:

$ echo $LANG
en_US.UTF-8

Printing to stdout is OK:

$ python -mhttpie GET news.ycombinator.org  --pretty 
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: private
Connection: close
Cache-Control: max-age=0
<snip/>

Piping Unicode output to a pager (or anything else reading from stdin) results in UnicodeEncodeError

$ python -mhttpie GET news.ycombinator.org  --pretty | less
Traceback (most recent call last):
  File "/opt/local/lib/python3.2/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/opt/local/lib/python3.2/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "/opt/src/httpie/httpie/__main__.py", line 193, in <module>
    main()
  File "/opt/src/httpie/httpie/__main__.py", line 187, in main
    with_body=cli.OUT_RESPONSE_BODY in args.output_options
UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 13305: ordinal not in range(128)

Installer

It's quite complicated to install httpie, especially for non-Python folks. Some Linux distros already include it as a package but most often one still has to use pip or easy_install manually.

It would be great to have an installer that checks whether Python and pip are available and installs them if necessary before installing httpie itself. Something like curl https://raw.github.com/jkbr/httpie/master/install.sh | sh could be made quite universal.

Also, a homebrew recipe would be handy for Mac OSX user.

Related: #58

Unicode response error.

http GET etvnet.com

UnicodeEncodeError: 'ascii' codec can't encode characters in position 1935-1945: ordinal not in range(128)

adding 'no-proxy' option

would be handy in environments where need proxy and want to use httpie for testing locally created code that is deployed to 'localhost'.

Separate very slow pygments colorizing from JSON indentation

The Pygments JSON colorization is nice but noticeably slow. I would love to have separate --indent and --colorize options rather than simply --ugly which would be equivalent to http URL | python -m json.tool, which appears to be 3-4 times faster in my testing.

Interactive+masked password input for --auth

Curl allows for --user user_name to be specified, and reads the password in with interactive masked input if no value is provided. It'd be useful for httpie to have this, since right now I have to go and nuke my password from my shell history each time I use --auth.

Windows package

I think someone should use py2exe or a similar tool to make an msi package for httpie.

Installing python and pip is a major hassle for anyone who just wants to use httpie on windows, which doesn't come with python installed by default.

Option to force pretty output on response, regardless of Content-type.

I'm noticing a few places where the response headers are coming back with a Content-type of "text/html" when they actually contain JSON. It would be nice if, in cases like these, you could somehow specify a format to "force" on the response so that the body could still be prettified.

'--verify no' still yields a certificate error

When testing an ssl enabled url, with a self signed certificatie, using the '--verify no' option still yields an error:

serge@phenicia:$ http -t get https://url
[Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
serge@phenicia:
$ http -t --verify no get https://url
[Errno 185090050] _ssl.c:340: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib

GET request sends Content-Type by default

Maybe I'm crafting my request wrong, but I would expect a simple GET request to not include a Content-Type header.

[~] βž” http --print H GET localhost:4440/api/2/project/test/jobs X-Rundeck-Auth-Token:asdf Accept:text/xml
GET /api/2/project/test/jobs HTTP/1.1
Accept-Encoding: identity, deflate, compress, gzip
X-Rundeck-Auth-Token: asdf
Accept: text/xml
User-Agent: HTTPie/0.2.2
Host: localhost:4440
Content-Type: application/x-www-form-urlencoded; charset=utf-8

I didn't expect to see a Content-Type header in the GET request, as there is no document body.

(This caused an issue because the server is Grails 1.3.7 which mis-interprets the Content-Type to be the expected output type. )

make Pygments dependency optional

As I understand it, Pygments is only required for syntax highlighting.

While that's useful to many/most, it seems a bit heavyweight - so it'd be nice if Pygments was optional.
(Seems like implementing that should be fairly simple - only I'm not sure how best to declare optional dependencies in setup.py.)

(From a Unix perspective, it be nice to have syntax highlighting as a separate tool, so one could do something like cat http | highlight.)

"binary data not shown in terminal" appears with HTML response

Sometimes, HTTPie appears to mistake HTML response data for binary data.

These were the headers that resulted in the unexpected behavior:

HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sun, 12 Aug 2012 22:51:24 GMT
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.0
Cache-Control: private
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Transfer-Encoding: chunked

Perhaps HTTPie is being confused by the Transfer-Encoding header?

Issue for Testing

Test httpie advanced usage by posting a comment on this issue:

http -a <username> https://api.github.com/repos/httpie/httpie/issues/83/comments body='Your Comment'

Support for changing default content type

I like using HTTPie, but it's annoying to type -f every time I send data. JSON is an interesting default since it seems like standard form data is just as common, and sending encoded JSON is more of a deviation from the norm. I'd vote for changing the default, but in either case, having a .httpierc or similar file where you can specify the preferred behavior would let you set a preference and forget it.

Python 3 & non-ascii arguments => UnicodeEncodeError

$ python --version
Python 3.2.2

$ http GET httpie.org hello:č
Traceback (most recent call last):
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/httpie-0.1.7_dev-py3.2.egg/httpie/__main__.py", line 146, in main
    allow_redirects=args.allow_redirects,
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/requests-0.10.6-py3.2.egg/requests/api.py", line 39, in request
    return s.request(method=method, url=url, **kwargs)
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/requests-0.10.6-py3.2.egg/requests/sessions.py", line 200, in request
    r.send(prefetch=prefetch)
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/requests-0.10.6-py3.2.egg/requests/models.py", line 535, in send
    timeout=self.timeout,
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/requests-0.10.6-py3.2.egg/requests/packages/urllib3/connectionpool.py", line 384, in urlopen
    body=body, headers=headers)
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/requests-0.10.6-py3.2.egg/requests/packages/urllib3/connectionpool.py", line 260, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.2.2/lib/python3.2/http/client.py", line 964, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/Cellar/python3/3.2.2/lib/python3.2/http/client.py", line 997, in _send_request
    self.putheader(hdr, value)
  File "/usr/local/Cellar/python3/3.2.2/lib/python3.2/http/client.py", line 940, in putheader
    values[i] = one_value.encode('latin1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\u010d' in position 0: ordinal not in range(256)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jakub/.virtualenv/test-p3/bin/http", line 9, in <module>
    load_entry_point('httpie==0.1.7-dev', 'console_scripts', 'http')()
  File "/Users/jakub/.virtualenv/test-p3/lib/python3.2/site-packages/httpie-0.1.7_dev-py3.2.egg/httpie/__main__.py", line 154, in main
    sys.stderr.write(str(e.message) + NEW_LINE)
AttributeError: 'UnicodeEncodeError' object has no attribute 'message'

Missing dependency argparse

I installed under Python 2.6:

Traceback (most recent call last):
File "/usr/local/bin/http", line 9, in
load_entry_point('httpie==0.1.4', 'console_scripts', 'http')()
File "/Library/Python/2.6/site-packages/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.6/site-packages/pkg_resources.py", line 2279, in load_entry_point
return ep.load()
File "/Library/Python/2.6/site-packages/pkg_resources.py", line 1989, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "/Library/Python/2.6/site-packages/httpie/httpie.py", line 5, in
import argparse
ImportError: No module named argparse

I manually installed argparse and all was well.

Python 3 is not supported

I guess Python 3 is not supported. I'm getting following error on Python 3.2:

Traceback (most recent call last):
  File "C:\Python32\Scripts\http-script.py", line 9, in <module>
    load_entry_point('httpie==0.1.4', 'console_scripts', 'http')()
  File "c:\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\pkg_resources.py", line 2280, in load_entry_point
    return ep.load()
  File "c:\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\pkg_resources.py", line 1990, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "c:\Python32\lib\site-packages\httpie\httpie.py", line 160
    u'HTTP/{version} {status} {reason}'.format(
                                      ^
SyntaxError: invalid syntax

Support for pretty without colors

Basically just the pretty printing. This would be very useful for directing responses to a file. An alternative would be to have a style none or something similar, so I could do

http -b --pretty --style none localhost:8080/foo.json > foo.json

and get pretty-printed json in the file without the esc sequences.

Method suggestion proposal

It would be nice if httpie would have the ability to suggest HTTP method by the following rules:

If METHOD argument is omitted and no ITEM arguments are given then method is GET:
http http://example.com/ is shortcut for http GET http://example.com.

If METHOD argument is omitted but at least one ITEM is given then method is POST:
http http://example.com/ hello=world is shortcut for http POST http://example.com hello=world.

If METHOD is specified then http behaves as it is now.

The first argument should be treated as method if it matches ^[a-zA-Z]+$ regexp. Otherwise it is url.

There are some complexity of implementing such behavior raises due to usage of argparse module, but in my opinion such shortcut would be very helpful in everyday usage of httpie.

verbose flag causing error with traceback

While trying to debug a server issue today I used the verbose flag for the first time. That resulted in the following traceback:


$ http -v get http://jsonip.com/
Traceback (most recent call last):
  File "/usr/local/bin/http", line 8, in <module>
    load_entry_point('httpie==0.2.0', 'console_scripts', 'http')()
  File "/Library/Python/2.7/site-packages/httpie/__main__.py", line 115, in main
    output = _get_output(args, stdout_isatty, response)
  File "/Library/Python/2.7/site-packages/httpie/__main__.py", line 89, in _get_output
    message=httpmessage.from_request(response.request),
  File "/Library/Python/2.7/site-packages/httpie/httpmessage.py", line 28, in from_request
    body=request._enc_data,
AttributeError: 'Request' object has no attribute '_enc_data'

error when `pip install -U https://github.com/jkbr/httpie/tarball/master`

latest cygwin, Python 2.6.7

Error message:
`$ pip install -U https://github.com/jkbr/httpie/tarball/master
Downloading/unpacking https://github.com/jkbr/httpie/tarball/master
Downloading master (145Kb): 145Kb downloaded
Running setup.py egg_info for package from https://github.com/jkbr/httpie/tarball/master
Traceback (most recent call last):
File "", line 14, in
File "/tmp/pip-lpvG3J-build/setup.py", line 21, in
long_description=open('README.md').read(),
IOError: [Errno 2] No such file or directory: 'README.md'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 14, in

File "/tmp/pip-lpvG3J-build/setup.py", line 21, in

long_description=open('README.md').read(),

IOError: [Errno 2] No such file or directory: 'README.md'


Command python setup.py egg_info failed with error code 1
Storing complete log in /home/chenbi/.pip/pip.log
`

No distributions at all found for httpi

Trying to install with pip on ubuntu I get the above error. Am I missing something?

pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)

No distributions at all found for httpi
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 948, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 152, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for httpi
goer ~/proj/temascrape $

Support specifing files to upload using @<file> instead of only piping

To upload a fle via POST or PUT, for example a JSON file, the current approach is to pipe the file:

http --json PUT http://server/url < /tmp/resources.json

It would be cleaner, esp in shell scripts, to use a similar format as for --form and treat the filename as an argument:

http --json PUT http://server/url @/tmp/resources.json

Thanks for httpie, my console thanks you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.