PyFCM icon indicating copy to clipboard operation
PyFCM copied to clipboard

project_id and service_account_file should be optional arguments

Open J-Priebe opened this issue 6 months ago • 2 comments

Hello,

FCMNotification(BaseAPI) allows you to supply either a service_account_file to load credentials from, or an already-loaded credentials argument. However because service_account_file is positional, you must supply a falsey value to indicate you are using credentials.

Also, project_id is a property of the google.oauth2.Credentials object, so it could be inferred if not explicitly provided. I'm not sure when/if your Credentials object wouldn't have a project_id associated with it, but that could be raised as an exception if neither the credentials nor the project_id argument provide it.

IMO it would be great if these were both optional parameters, to make both methods of passing credentials a little less clunky.

I'd be happy to open a PR if you agree with this, cheers!

J-Priebe avatar Aug 20 '24 20:08 J-Priebe