mackliet / church_of_jesus_christ_api

13 stars 8 forks source link

Photo API? #9

Closed dyoung418 closed 8 months ago

dyoung418 commented 11 months ago

Does the church have an endpoint for downloading a photo of a member that could be added to the API?

mackliet commented 11 months ago

I'll try to take a look at it sometime this week, there must be something.

mackliet commented 10 months ago

I added a download_member_photo method, it returns None if no photo is available, or a bytes object for the photo as a JPEG

dyoung418 commented 9 months ago

Thank you!

On Fri, Dec 29, 2023 at 11:29 PM Michael Mackliet @.***> wrote:

Closed #9 https://github.com/mackliet/church_of_jesus_christ_api/issues/9 as completed.

— Reply to this email directly, view it on GitHub https://github.com/mackliet/church_of_jesus_christ_api/issues/9#event-11359569579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZVCVB3UI6IVKWZT2P3A2LYL67G5AVCNFSM6AAAAAA7SK4JNCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGM2TSNJWHE2TOOI . You are receiving this because you authored the thread.Message ID: <mackliet/church_of_jesus_christ_api/issue/9/issue_event/11359569579@ github.com>

dyoung418 commented 9 months ago

I might be doing something wrong, but I'm unable to find this API endpoint. The documentation site doesn't list it and if I look at the code, I think it is supposed to be api.download_member_photo(), but in trying that, i get an error that it doesn't exist.

mackliet commented 9 months ago

Good call, I forgot to update the docs. I should add a git hook or CI/CD check or something for that...

I tried on my machine pip install church_of_jesus_christ_api --upgrade

and then in the python console I did this:

from church_of_jesus_christ_api import ChurchOfJesusChristAPI as API
api = API(<username>, <password>)
with open("my_photo.jpeg", "wb") as file:
  file.write(api.download_member_photo())

And you should be able to see your own photo in your current working directory

dyoung418 commented 9 months ago

Works great. Thank you!

connwork commented 8 months ago

Hi @mackliet

Is there a way to use this for multiple people? Using something like this isn't working for me:

file.write(api.download_member_photo(member_id=xxxxxxxxxxx))