Fix reconnect, add auth on pool creation

Support pool creation from url including db, username, and password
This commit is contained in:
Don Brown
2014-02-23 11:22:33 -08:00
parent c7ad1b1ba0
commit ca538a08ce
4 changed files with 74 additions and 19 deletions

17
asyncio_mongo/auth.py Normal file
View File

@@ -0,0 +1,17 @@
import asyncio
class Authenticator:
def authenticate(self, db):
raise NotImplementedError()
class CredentialsAuthenticator():
def __init__(self, username, password):
self.username = username
self.password = password
@asyncio.coroutine
def authenticate(self, db):
yield from db.authenticate(self.username, self.password)