Closed binhex closed 1 year ago
You can call get_community()
to get the id without previously knowing it. The flow should look something like:
srv = LemmyHttp("<instance>")
srv.login("<username>", "<password>")
output = srv.get_community(name="<community name>")
data = output.json()
The 'community_id' would then be in data['community_view']['community']['id']
.
I agree that it would be simpler, but this is a limitation with the Lemmy API itself, not @tjkessler's implementation from what I can tell: Here is the API documentation for 'getCommunity' from Lemmy
Right now Plemmy is aiming for parity with the LemmyHttp API. In the future I would like to implement some higher-level functions to help users avoid JSON dictionary indexing/keying, e.g., a "get_community" function that will return a community ID directly. Stay tuned!
Edit: keeping this issue open as motivation for me to get this done
Closing this issue now that Plemmy 0.3.0 is released! See source code and examples for how to easily access this information without having to parse JSON yourself.
Hi, just going through your example and I'm a little confused by the
community_id
where do I find this value in Lemmy, and wouldn't it be simpler to just allow a developer to specify the string value for the community instead?.