Skip to content

Commit

Permalink
Raise Authentication exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
joente committed Mar 9, 2017
1 parent aaa16e4 commit cba1673
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2017.03.09, Version 2.0.5 (BETA)

- Raise Authentication Errors on connect.

2017.02.27, Version 2.0.4 (BETA)

- Check for correct types using assert in query method.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from distutils.core import setup
import setuptools

VERSION = '2.0.4'
VERSION = '2.0.5'

setup(
name='siridb-connector',
Expand Down
3 changes: 2 additions & 1 deletion siridb/connector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .lib.client import SiriDBClient


__version_info__ = (2, 0, 4)
__version_info__ = (2, 0, 5)
__version__ = '.'.join(map(str, __version_info__))
__maintainer__ = 'Jeroen van der Heijden'
__email__ = '[email protected]'
Expand All @@ -20,6 +20,7 @@
'SiriDBProtocol',
]


class SiriDBProtocol(_SiriDBProtocol):

def on_connection_made(self):
Expand Down
19 changes: 11 additions & 8 deletions siridb/connector/lib/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
from .protomap import CPROTO_REQ_PING
from .protomap import FILE_MAP


class SiriDBConnection():

def __init__(self,
username,
password,
dbname,
host='127.0.0.1',
port=DEFAULT_CLIENT_PORT,
loop=None,
timeout=10,
protocol=_SiriDBProtocol):
username,
password,
dbname,
host='127.0.0.1',
port=DEFAULT_CLIENT_PORT,
loop=None,
timeout=10,
protocol=_SiriDBProtocol):
self._loop = loop or asyncio.get_event_loop()
client = self._loop.create_connection(
lambda: protocol(username, password, dbname),
Expand All @@ -35,6 +36,7 @@ async def _wait_for_auth(self):
except Exception as exc:
logging.debug('Authentication failed: {}'.format(exc))
self._transport.close()
raise exc
else:
self._protocol.on_authenticated()

Expand Down Expand Up @@ -133,6 +135,7 @@ async def connect(self,
except Exception as exc:
logging.debug('Authentication failed: {}'.format(exc))
_transport.close()
raise exc
else:
self._protocol.on_authenticated()

Expand Down

0 comments on commit cba1673

Please sign in to comment.