Skip to content

Commit

Permalink
Ignore alpn errors on old ssl & python3.4. Should work with apple ser…
Browse files Browse the repository at this point in the history
…ver without ALPN
  • Loading branch information
etataurov committed Oct 28, 2016
1 parent d1ea94b commit 8cd18a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion asyncio_apns/h2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def connect(cls, host: str, port: int,
if loop is None:
loop = asyncio.get_event_loop()
ssl_context = ssl.create_default_context()
ssl_context.set_alpn_protocols(["h2"])
try:
ssl_context.set_alpn_protocols(["h2"])
except (NotImplementedError, AttributeError):
pass
if not verify_ssl:
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
Expand Down

0 comments on commit 8cd18a6

Please sign in to comment.