Jump to content
Korean Random
P.vasiliy

[urllib2.urlopen] Error - sslv3 alert handshake failure

Recommended Posts

Добрый вечер.

Подскажите как избавится от ошибки.

from urllib2 import urlopen
print urlopen('https://ideone.com/plain/xdlcE7', timeout = 3).read()
Traceback (most recent call last):
  File "scripts/client/game.py", line 156, in init
  File "scripts/client/gui/shared/personality.py", line 371, in init
  File "scripts/client/gui/mods/__init__.py", line 19, in init
  File "scripts/client/gui/mods/__init__.py", line 67, in _findValidMODs
  File "scripts/common/Lib/importlib/__init__.py", line 37, in import_module
  File "mod_test", line 4, in <module>
  File "scripts/common/Lib/urllib2.py", line 127, in urlopen
  File "scripts/common/Lib/urllib2.py", line 404, in open
  File "scripts/common/Lib/urllib2.py", line 422, in _open
  File "scripts/common/Lib/urllib2.py", line 382, in _call_chain
  File "scripts/common/Lib/urllib2.py", line 1222, in https_open
  File "scripts/common/BWAutoImport.py", line 78, in do_open
URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>

В клиенте испольется Python версии 2.7.7rc1

Про эту ошибку пишут следущее:

The server you are trying to reach requires (SNI) Server Name Indication
and will cause a handshake failure if the client is not using this SNI extension.
Support for SNI was only added with python 2.7.9 so it looks like you are out of luck.

Т.е. нужен Python версии 2.7.9, которого в клиенте нет.

 

Заранее благодарю за ответ :smile:

С уважением, Василий.

Edited by P.vasiliy

Share this post


Link to post

Short link
Share on other sites

@P.vasiliy глянь в xvm - может поможет 

https://bitbucket.org/XVM/xvm/src/f450abb8350d183c37cd05ba7a7b1e60c9415499/src/xpm/xvm_main/loadurl.py?at=default&fileviewer=file-view-default

Они раньше tlslite юзали - попробуй через него 

Edited by SkepticalFox

Share this post


Link to post

Short link
Share on other sites

@SkepticalFox , что интересно до патча 1.4.0.0 все работало нормально.

 

Ну и так к слову пример обращения:

urlopen('https://static.modxvm.com/wn8-data-exp/json/wn8exp.json', timeout = 3).read()

Проходит как и должен, без ошибок, хотя на XVM-ом сайте тоже защищенное соединение используется.

А с ресурса - ideone.com

urlopen('https://ideone.com/plain/xdlcE7', timeout = 3).read()

Приводит к ошибке.

Share this post


Link to post

Short link
Share on other sites

@P.vasiliy 

Описание ошибки довольно таки точное (тот текст на английском)

Сервер CloudFlare (тот что проксирует) используют SNI для верефикации соеденения

Ребята с XVM такую верификацию не используют

 

Воспользуйтесь BigWorld.fetchURL(url, callback, [headers, timeout, method, postData])

Из бонусов кроме решения проблемы, он асинхронен (можно красиво обернуть в async и process)

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites
51 минуту назад, POLIROID сказал:

Воспользуйтесь BigWorld.fetchURL

WL ругаться не будет?

Share this post


Link to post

Short link
Share on other sites
11 часов назад, ShuraBB сказал:

WL ругаться не будет?

нет, причем тут браузер :)

Share this post


Link to post

Short link
Share on other sites

By the way, начиная с XFW.Native 1.4.3.0090 / XFW 7.9.4.1195 / XVM 7.9.4.9108 в клиент бэкпортируются HTTP и SSL стеки от CPython 2.7.16. 

 

То есть, начнёт работать и через urllib2, если дропнуть в клиент .wotmod с XFW.Native.

Edited by Mixaill
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...