Skip to content

Instantly share code, notes, and snippets.

@LordGaav
Last active August 21, 2017 19:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LordGaav/4674198 to your computer and use it in GitHub Desktop.
Save LordGaav/4674198 to your computer and use it in GitHub Desktop.
Ugly Python hack to make SSL work properly with broken SSL servers and Ubuntu 12.04
try:
# Ugly hack to force SSLv3 and avoid
# urllib2.URLError: <urlopen error [Errno 1] _ssl.c:504: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error>
import _ssl
_ssl.PROTOCOL_SSLv23 = _ssl.PROTOCOL_TLSv1
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment