Fedihosting-Foundation / plemmy

A Python package for accessing the LemmyHttp API
Apache License 2.0
45 stars 15 forks source link

Failure to get community on lemmy version 19.5 #39

Closed eerongal closed 2 weeks ago

eerongal commented 1 month ago

Running a small bot with this library, and the most recent update to 19.5 broke the GetCommunityResponse call

api_response = lemmy.get_community(name=comm_name)
response = GetCommunityResponse(api_response)

fails with:

Traceback (most recent call last):
  File "C:\Users\ericn\PycharmProjects\rssLemmyBot\main.py", line 106, in <module>
    post(entries, lemmy, con)
  File "C:\Users\ericn\PycharmProjects\rssLemmyBot\main.py", line 35, in post
    response = GetCommunityResponse(api_response)
  File "C:\Users\ericn\PycharmProjects\rssLemmyBot\venv\lib\site-packages\plemmy\responses.py", line 175, in __init__
    self.community_view = CommunityView(response["community_view"])
  File "C:\Users\ericn\PycharmProjects\rssLemmyBot\venv\lib\site-packages\plemmy\views.py", line 18, in __init__
    self.parse()
  File "C:\Users\ericn\PycharmProjects\rssLemmyBot\venv\lib\site-packages\plemmy\views.py", line 167, in parse
    self.community = Community(**self._view["community"])
TypeError: Community.__init__() got an unexpected keyword argument 'visibility'

Process finished with exit code 1

It looks like new fields were added to the lemmy API. Not sure if this extends beyond just the community call, its the first one i ran into.