HTTPie 1.0.0-dev
HTTPie data: /Users/kaji/.httpie
Requests 2.5.3
Pygments 2.0.2
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] darwin
Not every SSL website shows though. So, it is tricky. From browser , it is working fine.
>>> requests.request({'allow_redirects': False,
'auth': None,
'cert': None,
'data': OrderedDict(),
'files': DataDict(),
'headers': {'User-Agent': 'HTTPie/1.0.0-dev'},
'method': 'get',
'params': ParamsDict(),
'proxies': {},
'stream': True,
'timeout': 30,
'url': u'https://apissl.example.com',
'verify': True})
Traceback (most recent call last):
File "/usr/local/bin/http", line 9, in <module>
load_entry_point('httpie==1.0.0-dev', 'console_scripts', 'http')()
File "/Library/Python/2.7/site-packages/httpie/core.py", line 112, in main
response = get_response(args, config_dir=env.config.directory)
File "/Library/Python/2.7/site-packages/httpie/client.py", line 41, in get_response
response = requests_session.request(**kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol
@kajisaap URLμ΄ λ¬΄μμ΄μλμ? apissl.example.com
μ΄(κ°) ν΄κ²°λμ§ μμ΅λλ€.
@jakubroztocil λΆμ¬λ£κ³ μΆμ§λ§ κ³΅κ° λ¬Έμ λͺ©λ‘μ νμ¬ URLμ΄ νμλλ κ²μ΄ μ«μ΅λλ€. κ·Έλμ λλ²κ·Έ λ‘κ·Έλ₯Ό λΆμ¬λ£μμ΅λλ€. API λμ URLμ΄ λλ²κΉ λͺ©μ μΌλ‘ μ€μν κ²½μ° κ°μΈμ μΌλ‘ λ©μμ§λ₯Ό 보λ΄λ €λ©΄ μ΄λ»κ² ν΄μΌ ν©λκΉ?
@jakubroztocil , μ¬κΈ°μμ μ μ¬μ±μ κ°μ ν©λλ€ https://github.com/kennethreitz/requests/issues/2056
μ μ€νΈλ¦Ό λ¬Έμ μΈ κ² κ°μ΅λλ€. λ§ν¬λ λ¬Έμ μ μΈκΈλ ν¨ν€μ§λ₯Ό μ€μΉν΄ 보μμμ€.
λ Έλ ₯νλ€
$ pip install --force-reinstall requests[security]
@kajisaap λ λμ λμμ λ릴 μ μλλ‘ URLμ μ΄λ©μΌλ‘ 보λ΄μ£ΌμΈμ. λ΄ μ΄λ©μΌμ λ΄ νλ‘ν νμ΄μ§μ μμ΅λλ€.
@sigmavirus24 sudo pip install --force-reinstall 'requests[security]' --upgrade
λμμ΄ λμ§ μμμ΅λλ€. μμ€ν
μ λ³΄κ° μ°¨μ΄λ₯Ό λ§λ€ μ μλ κ²½μ° μ λ Yosemite 10.10.2λ₯Ό μ¬μ© μ€μ
λλ€.
@kajisaap openssl version
λ‘ λκΈλ λ¬ μ μλμ?
μ°Έκ³ μ¬ν: @jakubroztocil μμ²μ λν λλ²κ·Έ νΈμΆμ΄ μλͺ»λμμ΅λλ€. requests.request
μ ν΄λΉ μ¬μ μ νμ©νμ§ μμ΅λλ€. κ°μΉλ requests.request(**{ #...
μ¬μΌ ν©λλ€.
@kajisaap λ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
$>python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 0.9.8zc 15 Oct 2014
@sigmavirus24 κ°μ¬ν©λλ€, μμ λμμ΅λλ€
κ·Έλμ μ λ python 3.4.2μ μΉμ¬μ΄νΈμ 0κ°μ λ¬Έμ κ° μμ΅λλ€. λ°λΌμ μ΄κ²μ SNI λ¬Έμ μΈ κ² κ°μ΅λλ€. μ°Έκ³ λ‘ μ΄κ²μ λ΄ openssl λ²μ μ λλ€.
>>> import ssl
>>> print(ssl.OPENSSL_VERSION)
OpenSSL 1.0.1l 15 Jan 2015
κ·Έλ¬λ λν μμ²λ§ μ€μΉνμ΅λλ€.
python 2.7.9μμλ λμΌν openssl λ²μ μμ λμΌνκ² μλν©λλ€. ν₯λ―Έλ‘κ²λ py2.7.9μ μμ virtualenvμ requests[security]
μ€μΉλ μ€ν¨νμ§λ§ pyOpenSSLμ SysCallError
μλ μ λλ‘ λ°νλλ __str__
λ©μλκ° μ μλμ΄ μμ§ μκΈ° λλ¬Έμ λ€λ₯Έ μ€λ₯κ° λ°μν©λλ€. νμνλ str
). μ΄ μ€λ₯λ νΈλμ
°μ΄ν¬ μ€ν¨λ‘ μΈν κ²μ΄κΈ°λ ν©λλ€. μ λ python 2.7.9(brew λλ Python.orgλ₯Ό ν΅ν΄)λ‘ μ
κ·Έλ μ΄λνκ³ opensslμ(brew λ° κ°μ μ°κ²°μ ν΅ν΄) μ
κ·Έλ μ΄λν©λλ€. λλ λν OSX 10.10μ μμ΅λλ€
#262 / #288μ 볡μ ν κ°μ λμκ° λ©λλ€.
@mathiasbynens μ΄κ²μ λ΄κ° λ§ν μμλ ν SNIμ μ무 κ΄λ ¨μ΄ μμ΅λλ€. @kajisaap μ΄ μλ΅μ λ©μ·μΌλ―λ‘ λλ μ΄κ²μ λΆμμ ν κ²μΌλ‘ λ«λ κ²μ λν΄ +1:μ λλ€.
@sigmavirus24 νΌλμ€λ½μ΅λλ€. λ°©κΈ μ΄μ λκΈμμ "μ΄κ²μ SNI λ¬Έμ μΈ κ² κ°μ΅λλ€" λΌκ³ λ§μνμ ¨μ΅λλ€.
μ΄ μ€λ₯λ μμμ νμΈν©λλ€.
$ http https://larlet.fr
http: error: SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol
ν΄λΉ λ²μ μ OpenSSL λ° HTTPie μ¬μ©:
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2 22 Jan 2015
$ http --version
0.9.2
λλ κ°μ μμ΄ μμ²μ 보μ λͺ¨λλ‘ κ°μ μ¬μ€μΉνμ΅λλ€.
localhostμμ hello-world Dropwizard μ±μ λλ₯΄λ λ° λμΌν λ¬Έμ κ° μμ΅λλ€(μμ μλ΅μ λΉ JSON λ°°μ΄μ).
$ http --verify=no https://localhost:8443/hello
http: error: SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",) while doing GET request to URL: https://localhost:8443/hello
$ curl -k https://localhost:8443/hello
[]
λλ μ¬μ ν μ΄κ²μλ³΄κ³ μλ€ :
$ python --version
Python 2.7.11
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2f 28 Jan 2016
μμ²μ 보μ λͺ¨λμ κ°μ λ‘ λ€μ μ€μΉνλ €κ³ νμ΅λλ€. κΈ°μ¨μ΄ μμ΅λλ€.
μλ
νμΈμ,
μ€νν λ python 2.7.9 λ° Requests λͺ¨λμ samme λ¬Έμ κ° μμ΅λλ€.
r = μμ².get(url=urloo,headers=self.headers, νμΈ=κ±°μ§)
urloo = https://10.xxx.xx.xxxx :yyyyy/oo/rest/latest/executions/21589456/summary
μμ² λ°ν:
νμΌ "C:ApplicationsPython27libsite-packagesrequests-2.9.1-py2.7.eggrequestsadapters.py", 447ν, 보λ΄κΈ°
SSLError(e, μμ²=μμ²) λ°μ
requests.exceptions.SSLError: [Errno 8] _ssl.c:507: νλ‘ν μ½ μλ°μΌλ‘ EOFκ° λ°μνμ΅λλ€.
νμΈ ν€λκ° Falseλ‘ λ°°μΉλ©λλ€.
μλ§λ kennethreitz/requests#3006κ³Ό κ΄λ ¨μ΄ μμ κ²μ λλ€.
λκ΅°κ° Python 2.7.6μμ μ΄ λ¬Έμ λ₯Ό κ²½νν©λκΉ?
κ·Έλ μ§ μμ κ²½μ° κ΄λ ¨λ μ μμ΅λλ€. http://stackoverflow.com/questions/32330919/python-ssl-ssl-sslerror-ssl-unsupported-protocol-unsupported-protocol-ssl
@sigmavirus24 κ° μ μν μμ μ μννμ¬ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μμμ΅λλ€.
pip install --force-reinstall requests[security]
μ΄κ²μ macOS Sierra 10.12μ python 2.7.10κ³Ό ν¨κ»μμ΅λλ€.
https://github.com/jkbrzt/httpie#sni -μλ² μ΄λ¦ νμ
https://github.com/apache/fineract/pull/644 μμ apt-get install httpie
λ²μ μ΄ Travis CIμ μ€μΉλλ( dist: trusty
ν¬ν¨) μ΄ λ¬Έμ λ₯Ό ν΄κ²°νμ΅λλ€. --verify=no
( --verify no
μλ)λ₯Ό μ¬μ©νμ¬ μμ νμ΅λλ€. (SSLμ΄ μλ κ³΅κ° μΉμ¬μ΄νΈμλ μ΄κ²μ μ¬μ©νκ³ μΆμ§ μμ κ²μ
λλ€. μ κ²½μ°μλ μ체 μλͺ
λ μΈμ¦μκ° μλ https://localhost:8443/...μ©μ΄μμ΅λλ€.)
https://github.com/jkbrzt/httpie#sni -μλ² μ΄λ¦ νμ
μ°Έκ³ λ‘ μ΄ μ΅μ»€λ κ·Έλμ μ κ±°λ κ² κ°μ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
λ Έλ ₯νλ€
@kajisaap λ λμ λμμ λ릴 μ μλλ‘ URLμ μ΄λ©μΌλ‘ 보λ΄μ£ΌμΈμ. λ΄ μ΄λ©μΌμ λ΄ νλ‘ν νμ΄μ§μ μμ΅λλ€.