fix: Accept Path-like objects in credential factory functions by hiranya911 · Pull Request #510 · firebase/firebase-admin-python

Credential factory functions like credentials.cert() currently only accept str typed file paths. But Python 3.4 introduced the pathlib module and with that a wide range of path-like types. This PR makes it possible to pass these path-like objects directly to our credential factory functions.

import pathlib

path = pathlib.Path('home', 'user', 'firebase.json')
cred = credentials.Cert(path)

Basically we are going to treat anything that is accepted by pathlib.Path as a valid file path. This constructor has good built-in argument validation, and throws TypeError for things that not path-like.

Resolves #501