mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 05:48:01 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
0eba037037 | |||
3898129e9c | |||
b88e88d2e3 | |||
d1407baf76 | |||
d5032ca859 | |||
f6a19cf552 | |||
74979f3b33 | |||
698eb51e60 | |||
ae8030c930 |
@ -6,6 +6,24 @@ This document records all notable changes to `HTTPie <http://httpie.org>`_.
|
||||
This project adheres to `Semantic Versioning <http://semver.org/>`_.
|
||||
|
||||
|
||||
`1.0.3-dev`_ (unreleased)
|
||||
-------------------------
|
||||
|
||||
* No changes yet.
|
||||
|
||||
|
||||
`1.0.2`_ (2018-11-14)
|
||||
-------------------------
|
||||
|
||||
* Fixed tests for installation with pyOpenSSL.
|
||||
|
||||
|
||||
`1.0.1`_ (2018-11-14)
|
||||
-------------------------
|
||||
|
||||
* Removed external URL calls from tests.
|
||||
|
||||
|
||||
`1.0.0`_ (2018-11-02)
|
||||
-------------------------
|
||||
|
||||
@ -308,13 +326,13 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
|
||||
* Many improvements and bug fixes
|
||||
|
||||
|
||||
`0.1`_ (2012-02-25)
|
||||
-------------------
|
||||
`0.1.0`_ (2012-02-25)
|
||||
---------------------
|
||||
|
||||
* Initial public release
|
||||
|
||||
|
||||
.. _`0.1`: https://github.com/jakubroztocil/httpie/commit/b966efa
|
||||
.. _`0.1.0`: https://github.com/jakubroztocil/httpie/commit/b966efa
|
||||
.. _0.1.4: https://github.com/jakubroztocil/httpie/compare/b966efa...0.1.4
|
||||
.. _0.1.5: https://github.com/jakubroztocil/httpie/compare/0.1.4...0.1.5
|
||||
.. _0.1.6: https://github.com/jakubroztocil/httpie/compare/0.1.5...0.1.6
|
||||
@ -341,3 +359,6 @@ This project adheres to `Semantic Versioning <http://semver.org/>`_.
|
||||
.. _0.9.8: https://github.com/jakubroztocil/httpie/compare/0.9.6...0.9.8
|
||||
.. _0.9.9: https://github.com/jakubroztocil/httpie/compare/0.9.8...0.9.9
|
||||
.. _1.0.0: https://github.com/jakubroztocil/httpie/compare/0.9.9...1.0.0
|
||||
.. _1.0.1: https://github.com/jakubroztocil/httpie/compare/1.0.0...1.0.1
|
||||
.. _1.0.2: https://github.com/jakubroztocil/httpie/compare/1.0.1...1.0.2
|
||||
.. _1.0.3-dev: https://github.com/jakubroztocil/httpie/compare/1.0.2...master
|
||||
|
15
Makefile
15
Makefile
@ -124,6 +124,21 @@ uninstall-all: uninstall-httpie
|
||||
- pip uninstall --yes -r $(REQUIREMENTS)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Docs
|
||||
###############################################################################
|
||||
|
||||
pdf:
|
||||
# NOTE: rst2pdf needs to be installed manually and against a Python 2
|
||||
@echo "Converting README.rst to PDF…"
|
||||
rst2pdf \
|
||||
--strip-elements-with-class=no-pdf \
|
||||
README.rst \
|
||||
-o README.pdf
|
||||
@echo "Done"
|
||||
@echo
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Utils
|
||||
###############################################################################
|
||||
|
@ -134,6 +134,9 @@ You can also install the latest unreleased development version directly from
|
||||
the ``master`` branch on GitHub. It is a work-in-progress of a future stable
|
||||
release so the experience might be not as smooth.
|
||||
|
||||
|
||||
.. class:: no-pdf
|
||||
|
||||
|unix_build|
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Generate URLs and file hashes to be included in the Homebrew formula
|
||||
after a new release of HTTPie has been published on PyPi.
|
||||
@ -12,8 +12,13 @@ import requests
|
||||
|
||||
PACKAGES = [
|
||||
'httpie',
|
||||
'requests',
|
||||
'pygments',
|
||||
'requests',
|
||||
'certifi',
|
||||
'urllib3',
|
||||
'idna',
|
||||
'chardet',
|
||||
'PySocks',
|
||||
]
|
||||
|
||||
|
||||
@ -50,7 +55,7 @@ def main():
|
||||
print(' url "{url}"'.format(url=dep_meta['url']))
|
||||
print(' sha256 "{sha256}"'.format(sha256=dep_meta['sha256']))
|
||||
print(' end')
|
||||
print()
|
||||
print('')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -5,40 +5,61 @@
|
||||
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/httpie.rb
|
||||
#
|
||||
class Httpie < Formula
|
||||
include Language::Python::Virtualenv
|
||||
|
||||
desc "User-friendly cURL replacement (command-line HTTP client)"
|
||||
homepage "https://httpie.org/"
|
||||
|
||||
url "https://pypi.python.org/packages/85/95/7ccea3ae7fd1185e21629f6d14fa9c896d6250bb15fb492efa91edc741a2/httpie-0.9.8.tar.gz"
|
||||
sha256 "515870b15231530f56fe2164190581748e8799b66ef0fe36ec9da3396f0df6e1"
|
||||
|
||||
url "https://files.pythonhosted.org/packages/44/ee/7177b743400d7f82a69bf30cb3c24ea4bb1f4aea68878bc540f732bf4940/httpie-1.0.0.tar.gz"
|
||||
sha256 "1650342d2eca2622092196bf106ab8f68ea2dbb2ed265d37191185618e159a25"
|
||||
head "https://github.com/jakubroztocil/httpie.git"
|
||||
|
||||
depends_on :python3
|
||||
|
||||
resource "requests" do
|
||||
url "https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz"
|
||||
sha256 "de5d266953875e9647e37ef7bfe6ef1a46ff8ddfe61b5b3652edf7ea717ee2b2"
|
||||
bottle do
|
||||
cellar :any_skip_relocation
|
||||
sha256 "7e9db255e324dd63b66106ca62ed7e4e81f6634c624dec3ff49c293aba1072a6" => :mojave
|
||||
sha256 "437504a11416284b17d3a801c267d0fd5e15416f38cff3abf7ed99b096b4828a" => :high_sierra
|
||||
sha256 "10b25fc787076719b1f1f9c242c5e9d872ebd1c7a6d83e6f1af983a17cd8ca55" => :sierra
|
||||
sha256 "1bd35480d1ef401bdad9c322e7c1624aefc9b5056530ab990e327d0bc397e4fb" => :el_capitan
|
||||
end
|
||||
|
||||
depends_on "python" ["3.6.5_1"]
|
||||
|
||||
resource "pygments" do
|
||||
url "https://pypi.python.org/packages/b8/67/ab177979be1c81bc99c8d0592ef22d547e70bb4c6815c383286ed5dec504/Pygments-2.1.3.tar.gz"
|
||||
sha256 "88e4c8a91b2af5962bfa5ea2447ec6dd357018e86e94c7d14bd8cacbc5b55d81"
|
||||
url "https://files.pythonhosted.org/packages/71/2a/2e4e77803a8bd6408a2903340ac498cb0a2181811af7c9ec92cb70b0308a/Pygments-2.2.0.tar.gz"
|
||||
sha256 "dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc"
|
||||
end
|
||||
|
||||
resource "requests" do
|
||||
url "https://files.pythonhosted.org/packages/97/10/92d25b93e9c266c94b76a5548f020f3f1dd0eb40649cb1993532c0af8f4c/requests-2.20.0.tar.gz"
|
||||
sha256 "99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c"
|
||||
end
|
||||
|
||||
resource "certifi" do
|
||||
url "https://files.pythonhosted.org/packages/41/b6/4f0cefba47656583217acd6cd797bc2db1fede0d53090fdc28ad2c8e0716/certifi-2018.10.15.tar.gz"
|
||||
sha256 "6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a"
|
||||
end
|
||||
|
||||
resource "urllib3" do
|
||||
url "https://files.pythonhosted.org/packages/a5/74/05ffd00b4b5c08306939c485869f5dc40cbc27357195b0a98b18e4c48893/urllib3-1.24.tar.gz"
|
||||
sha256 "41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae"
|
||||
end
|
||||
|
||||
resource "idna" do
|
||||
url "https://files.pythonhosted.org/packages/65/c4/80f97e9c9628f3cac9b98bfca0402ede54e0563b56482e3e6e45c43c4935/idna-2.7.tar.gz"
|
||||
sha256 "684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
|
||||
end
|
||||
|
||||
resource "chardet" do
|
||||
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
|
||||
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
|
||||
end
|
||||
|
||||
resource "PySocks" do
|
||||
url "https://files.pythonhosted.org/packages/53/12/6bf1d764f128636cef7408e8156b7235b150ea31650d0260969215bb8e7d/PySocks-1.6.8.tar.gz"
|
||||
sha256 "3fe52c55890a248676fd69dc9e3c4e811718b777834bcaab7a8125cf9deac672"
|
||||
end
|
||||
|
||||
def install
|
||||
pyver = Language::Python.major_minor_version "python3"
|
||||
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{pyver}/site-packages"
|
||||
%w[pygments requests].each do |r|
|
||||
resource(r).stage do
|
||||
system "python3", *Language::Python.setup_install_args(libexec/"vendor")
|
||||
end
|
||||
end
|
||||
|
||||
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{pyver}/site-packages"
|
||||
system "python3", *Language::Python.setup_install_args(libexec)
|
||||
|
||||
bin.install Dir["#{libexec}/bin/*"]
|
||||
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
test do
|
||||
|
BIN
httpie.png
BIN
httpie.png
Binary file not shown.
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 681 KiB |
@ -2,7 +2,7 @@
|
||||
HTTPie - a CLI, cURL-like tool for humans.
|
||||
|
||||
"""
|
||||
__version__ = '1.0.0'
|
||||
__version__ = '1.0.2'
|
||||
__author__ = 'Jakub Roztocil'
|
||||
__licence__ = 'BSD'
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Tests for dealing with binary request and response data."""
|
||||
import requests
|
||||
|
||||
from fixtures import BIN_FILE_PATH, BIN_FILE_CONTENT, BIN_FILE_PATH_ARG
|
||||
from httpie.compat import urlopen
|
||||
from httpie.output.streams import BINARY_SUPPRESSED_NOTICE
|
||||
from utils import MockEnvironment, http
|
||||
|
||||
@ -31,25 +32,19 @@ class TestBinaryRequestData:
|
||||
|
||||
|
||||
class TestBinaryResponseData:
|
||||
url = 'http://www.google.com/favicon.ico'
|
||||
|
||||
@property
|
||||
def bindata(self):
|
||||
if not hasattr(self, '_bindata'):
|
||||
self._bindata = urlopen(self.url).read()
|
||||
return self._bindata
|
||||
|
||||
def test_binary_suppresses_when_terminal(self):
|
||||
r = http('GET', self.url)
|
||||
def test_binary_suppresses_when_terminal(self, httpbin):
|
||||
r = http('GET', httpbin + '/bytes/1024')
|
||||
assert BINARY_SUPPRESSED_NOTICE.decode() in r
|
||||
|
||||
def test_binary_suppresses_when_not_terminal_but_pretty(self):
|
||||
def test_binary_suppresses_when_not_terminal_but_pretty(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('--pretty=all', 'GET', self.url,
|
||||
env=env)
|
||||
r = http('--pretty=all', 'GET', httpbin + '/bytes/1024', env=env)
|
||||
assert BINARY_SUPPRESSED_NOTICE.decode() in r
|
||||
|
||||
def test_binary_included_and_correct_when_suitable(self):
|
||||
def test_binary_included_and_correct_when_suitable(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('GET', self.url, env=env)
|
||||
assert r == self.bindata
|
||||
url = httpbin + '/bytes/1024?seed=1'
|
||||
r = http('GET', url, env=env)
|
||||
expected = requests.get(url).content
|
||||
assert r == expected
|
||||
|
@ -2,17 +2,31 @@ import os
|
||||
|
||||
import pytest
|
||||
import pytest_httpbin.certs
|
||||
from requests.exceptions import SSLError
|
||||
import requests.exceptions
|
||||
|
||||
from httpie import ExitStatus
|
||||
from httpie.input import SSL_VERSION_ARG_MAPPING
|
||||
from utils import http, HTTP_OK, TESTS_ROOT
|
||||
from utils import HTTP_OK, TESTS_ROOT, http
|
||||
|
||||
|
||||
try:
|
||||
# Handle OpenSSL errors, if installed.
|
||||
# See <https://github.com/jakubroztocil/httpie/issues/729>
|
||||
# noinspection PyUnresolvedReferences
|
||||
import OpenSSL.SSL
|
||||
ssl_errors = (
|
||||
requests.exceptions.SSLError,
|
||||
OpenSSL.SSL.Error,
|
||||
)
|
||||
except ImportError:
|
||||
ssl_errors = (
|
||||
requests.exceptions.SSLError,
|
||||
)
|
||||
|
||||
|
||||
CLIENT_CERT = os.path.join(TESTS_ROOT, 'client_certs', 'client.crt')
|
||||
CLIENT_KEY = os.path.join(TESTS_ROOT, 'client_certs', 'client.key')
|
||||
CLIENT_PEM = os.path.join(TESTS_ROOT, 'client_certs', 'client.pem')
|
||||
|
||||
# FIXME:
|
||||
# We test against a local httpbin instance which uses a self-signed cert.
|
||||
# Requests without --verify=<CA_BUNDLE> will fail with a verification error.
|
||||
@ -28,7 +42,7 @@ def test_ssl_version(httpbin_secure, ssl_version):
|
||||
httpbin_secure + '/get'
|
||||
)
|
||||
assert HTTP_OK in r
|
||||
except SSLError as e:
|
||||
except ssl_errors as e:
|
||||
if ssl_version == 'ssl3':
|
||||
# pytest-httpbin doesn't support ssl3
|
||||
assert 'SSLV3_ALERT_HANDSHAKE_FAILURE' in str(e)
|
||||
@ -57,12 +71,12 @@ class TestClientCert:
|
||||
assert 'No such file or directory' in r.stderr
|
||||
|
||||
def test_cert_file_invalid(self, httpbin_secure):
|
||||
with pytest.raises(SSLError):
|
||||
with pytest.raises(ssl_errors):
|
||||
http(httpbin_secure + '/get',
|
||||
'--cert', __file__)
|
||||
|
||||
def test_cert_ok_but_missing_key(self, httpbin_secure):
|
||||
with pytest.raises(SSLError):
|
||||
with pytest.raises(ssl_errors):
|
||||
http(httpbin_secure + '/get',
|
||||
'--cert', CLIENT_CERT)
|
||||
|
||||
@ -79,21 +93,23 @@ class TestServerCert:
|
||||
assert HTTP_OK in r
|
||||
|
||||
def test_verify_custom_ca_bundle_path(
|
||||
self, httpbin_secure_untrusted):
|
||||
self, httpbin_secure_untrusted
|
||||
):
|
||||
r = http(httpbin_secure_untrusted + '/get', '--verify', CA_BUNDLE)
|
||||
assert HTTP_OK in r
|
||||
|
||||
def test_self_signed_server_cert_by_default_raises_ssl_error(
|
||||
self,
|
||||
httpbin_secure_untrusted):
|
||||
with pytest.raises(SSLError):
|
||||
self,
|
||||
httpbin_secure_untrusted
|
||||
):
|
||||
with pytest.raises(ssl_errors):
|
||||
http(httpbin_secure_untrusted.url + '/get')
|
||||
|
||||
def test_verify_custom_ca_bundle_invalid_path(self, httpbin_secure):
|
||||
# since 2.14.0 requests raises IOError
|
||||
with pytest.raises((SSLError, IOError)):
|
||||
with pytest.raises(ssl_errors + (IOError,)):
|
||||
http(httpbin_secure.url + '/get', '--verify', '/__not_found__')
|
||||
|
||||
def test_verify_custom_ca_bundle_invalid_bundle(self, httpbin_secure):
|
||||
with pytest.raises(SSLError):
|
||||
with pytest.raises(ssl_errors):
|
||||
http(httpbin_secure.url + '/get', '--verify', __file__)
|
||||
|
Reference in New Issue
Block a user