Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
leonhard-s committed Jul 5, 2022
2 parents e95c3d3 + f52737d commit d8928f4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion auraxium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
]

__author__ = 'Leonhard S.'
__version__ = '0.2.1'
__version__ = '0.2.2'
7 changes: 6 additions & 1 deletion auraxium/_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ def __init__(self, loop: Optional[asyncio.AbstractEventLoop] = None,
self.profiling = profiling
self.service_id = service_id
self.session = aiohttp.ClientSession()
self._no_ssl_certs = no_ssl_certs
self._timing_cache: List[float] = []
if no_ssl_certs:
warnings.warn('SSL certificate expiration bypass is disabled in '
'this version of Auraxium due to compatibility '
'issues. See '
'<https://github.com/leonhard-s/auraxium/issues/56> '
'for details.', FutureWarning)

async def __aenter__(self: _T) -> _T:
"""Enter the context manager and return the client."""
Expand Down
17 changes: 11 additions & 6 deletions auraxium/event/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import contextlib
import json
import logging
import ssl
from typing import (Any, Callable, Coroutine, Dict, Iterator, List, Optional, Type, TypeVar, Union,
cast, overload)

Expand Down Expand Up @@ -265,11 +264,17 @@ async def _connection_handler(self) -> None:
"""
_log.info('Connecting to WebSocket endpoint...')
url = f'{_ESS_ENDPOINT}?environment=ps2&service-id={self.service_id}'
if self._no_ssl_certs:
ssl_ctx = ssl.SSLContext()
else:
ssl_ctx = None
async with ws_client.connect(url, ssl=ssl_ctx) as websocket:
# HACK: Recent updates to the WebSocket client library cause issues
# with the SSL certs bypass on some Python versions. They have been
# disabled for now and will be replaced with a more robust system down
# the road.

# if self._no_ssl_certs:
# ssl_ctx = ssl.SSLContext()
# else:
# ssl_ctx = None

async with ws_client.connect(url) as websocket:
self.websocket = websocket
_log.info('Connected to %s?environment=ps2&service-id=XXX',
_ESS_ENDPOINT)
Expand Down

0 comments on commit d8928f4

Please sign in to comment.