Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for password functions (useful for RDS IAM auth) #554
Conversation
@@ -601,6 +601,11 @@ def connection_lost(self, exc): | |||
raise asyncio.TimeoutError | |||
|
|||
connected = _create_future(loop) | |||
|
|||
params_input = params | |||
if callable(params.password): |
elprans
Apr 7, 2020
Member
Please also add support for coroutines (via inspect.iscoroutinefunction()
) to support async callbacks.
HLFrye
Apr 7, 2020
Author
Good point, updated the branch with support for async password callbacks and an additional test for that case as well.
await self._try_connect( | ||
user='password_user', | ||
password=get_wrongpassword) | ||
|
await self._try_connect( | ||
user='password_user', | ||
password=get_wrongpassword) | ||
|
LGTM. Please add a note about this to the |
@HLFrye Thanks so much for this change. I have a question though regarding RDS IAM before I open a new issue. I haven't been able to get this to connect to our RDS instance despite our callable generating valid tokens. I actually can't figure out how to get asyncpg to connect using a generated auth token at all, either by passing our callable or by generating the token and passing it directly into the
I've confirmed that I can use our same connection code to connect to a different postgres database using a standard password, and also that all of the values used and the token generated are valid and can be used to connect via psycopg2 and psql. The code is about as simple as possible:
where Any help would be greatly appreciated! |
Resolves this issue: #553