OSXPhotos provides the ability to interact with and query Apple’s Photos.app library on macOS. You can query the Photos library database — for example, file name, file path, and metadata such as keywords/tags, persons/faces, albums, etc. You can also easily export both the original and edited photos.

Source: Michael Tsai – Blog – OSXPhotos Python Tool