Skip to content

Ability to pass client_type to connect() or __init__() when using AsyncSimpleClient and AsyncClient subclasses #1432

@rmawatson

Description

@rmawatson

It would be great if there was an option to pass a client_type into AsyncSimpleClient.__init__() with a default of AsyncClient, or as an additional argument on AsyncSimpleClient.connect() so I can subclass both AsyncSimpleClient and AsyncClient, and still use 99% of their behavior.

Currently this is hardcoded, and the only option is to copy and paste the contents of AsyncSimpleClient.connect in a subclass of AsyncSimpleClient to customise this line if I am also using my own subclass of AsyncClient.

self.client = AsyncClient(*self.client_args, **self.client_kwargs)

would become

self.client = self.client_type(*self.client_args, **self.client_kwargs)

if passed into AsyncSimpleClient.__init__()

self.client = client_type(*self.client_args, **self.client_kwargs)

if passed in on AsyncSimpleClient.connect()

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions