티스토리 뷰

반응형

Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.

Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.

 

아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.

SSL InsecurePlatform error when using Requests package

Requests 패키지를 사용할 때 SSL InsecurePlatform 오류 발생

 문제 내용 

Im using Python 2.7.3 and Requests. I installed Requests via pip. I believe it's the latest version. I'm running on Debian Wheezy.

나는 Python 2.7.3과 Requests를 사용하고 있다. 나는 pip을 통해 Requests를 설치했다. 최신 버전인 것 같아요. 나는 Debian Wheezy에서 동작중이다.

 

I've used Requests lots of times in the past and never faced this issue, but it seems that when making https requests with Requests I get an InsecurePlatform exception.

나는 과거에 요청을 많이 사용했고 이 문제에 직면한 적이 없지만, 요청으로 https 요청을 할 때 안전하지 않은 플랫폼 예외가 발생하는 것 같다.

 

The error mentions urllib3, but I don't have that installed. I did install it to check if it resolved the error, but it didn't.

에러에 urllib3라고 뜨는데, 그것을 설치하지 않았어요. 오류가 해결되었는지 확인하기 위해 설치했지만, 해결되지 않았습니다.

 

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3
/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not
available. This prevents urllib3 from configuring SSL appropriately and 
may cause certain SSL connections to fail. For more information, see 
https://urllib3.readthedocs.org/en/latest  
/security.html#insecureplatformwarning.

Any ideas as to why I'm getting this? I've checked the docs, as specified in the error message, but the docs are saying to import urllib3 and either disable the warning, or provide a certificate.

내가 왜 이걸 받는지 알아? 오류 메시지에 명시된 대로 문서를 확인했지만, 문서에서 urllib3를 가져와서 경고를 비활성화하거나 인증서를 제공하라고 합니다.

 

 

 

 높은 점수를 받은 Solution 

Use the somewhat hidden security feature:

숨겨진 보안 기능을 사용합니다.

 

pip install requests[security] or pip install pyOpenSSL ndg-httpsclient pyasn1

pip 설치 요청[보안] 또는 pip 설치 pyOpenSSL ndg-http 클라이언트 pyasn1

 

Both commands install following extra packages:

두 명령 모두 다음과 같은 추가 패키지를 설치합니다.

 

  • pyOpenSSL
  • cryptography
  • idna

 

Please note that this is not required for python-2.7.9+.

python-2.7.9+에는 필요하지 않습니다.

 

If pip install fails with errors, check whether you have required development packages for libffi, libssl and python installed in your system using distribution's package manager:

pip 설치가 오류로 실패하면 배포의 패키지 관리자를 사용하여 시스템에 libffi, libssl 및 python에 필요한 개발 패키지가 설치되어 있는지 확인하십시오.

 

  • Debian/Ubuntu - python-dev libffi-dev libssl-dev packages.
  • Fedora - openssl-devel python-devel libffi-devel packages.

 

Distro list above is incomplete.

위의 배포 목록이 불완전합니다.

 

Workaround (see the original answer by @TomDotTom):

해결 방법(@TomDotTom의 원본 답변 참조):

 

In case you cannot install some of the required development packages, there's also an option to disable that warning:

필요한 개발 패키지 중 일부를 설치할 수 없는 경우 해당 경고를 비활성화하는 옵션도 있습니다.

 

import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()

If your pip itself is affected by InsecurePlatformWarning and cannot install anything from PyPI, it can be fixed with this step-by-step guide to deploy extra python packages manually.

Pip 자체가 안전하지 않은 플랫폼 경고의 영향을 받아 PyPI에서 아무것도 설치할 수 없는 경우 이 단계별 가이드를 사용하여 추가 Python 패키지를 수동으로 배포할 수 있습니다.

 

 

 

 가장 최근 달린 Solution 

All of the solutions given here haven't helped (I'm constrained to python 2.6.6). I've found the answer in a simple switch to pass to pip:

여기에 제공된 모든 솔루션은 도움이 되지 않았습니다(나는 python 2.6.6으로 제한되어 있습니다). 나는 pip에 전달하는 간단한 스위치에서 답을 찾았다:

 

$ sudo pip install --trusted-host pypi.python.org <module_name>

This tells pip that it's OK to grab the module from pypi.python.org.

이것은 pip에게 pypi.python.org.에서 모듈을 가져와도 괜찮다고 말한다.

 

For me, the issue is my company's proxy behind it's firewall that makes it look like a malicious client to some servers. Hooray security.

나에게 문제는 일부 서버에서 악의적인 클라이언트처럼 보이게 하는 방화벽 뒤에 있는 회사의 프록시입니다. 경비원 만세!

 


Update: See @Alex 's answer for changes in the PyPi domains, and additional --trusted-host options that can be added. (I'd copy/paste here, but his answer, so +1 him)

업데이트: @Alex's 참조 추가할 수 있는 --trusted-host 옵션과 PyPi 도메인의 변경 사항에 대한 응답(여기에 복사/붙여넣기는 하겠지만, 그의 대답은 +1 그입니다)

 

 

 

출처 : https://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package

반응형
댓글
공지사항
최근에 올라온 글