class Authenticator:
def __init__(api_key: str, user_pass: tuple[str, str]):
raise NotImplemented
What' the cleanest way to write that Authenticator can be instantiated or via an api key or via a username-password tuple (but not both obviously)? I'd like to keep both parameters in the constructor.
I think it will be more readable if you use two different methods instead of constructor method
class Authenticator:
def auth_by_key(api_key):
pass
def auth_by_u_p(u, p):
pass