Fedihosting-Foundation / plemmy

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

Fix for get_community function #3

Closed ihyoudou closed 1 year ago

ihyoudou commented 1 year ago

I'm not sure why, but lemmy doesn't seem to accept name or id in request body for that endpoint (returns HTTP code 400 - {"error":"no_id_given"}. When it is passed as a param, it works.

Example code to test:

from plemmy import LemmyHttp

api = LemmyHttp("https://sh.itjust.works")
api.login("dummy_username", "dummy_password")
community = api.get_community(name="opensource@lemmy.ml")
print(community)
print(community.json())
tjkessler commented 1 year ago

Nice find! Is this the case just for _getcommunity, or are other GET operations affected?

ihyoudou commented 1 year ago

As of right now, I'm not aware of other endpoints that have this issue, but I was also not looking that deep into it

tjkessler commented 1 year ago

Well, with your to _gethandler edits, any similar bugs can easily be fixed! Thanks for the contribution, merging now.