this post was submitted on 20 Jun 2023
17 points (100.0% liked)

Python

6347 readers
2 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

Hello everyone!

I'm here to share a project I've been working on, Plemmy. Plemmy is a Python package for accessing the Lemmy API, specifically through LemmyHttp.

Feel free to offer advice and contribute!

Edit: version 0.2.0 released, all LemmyHttp operations are supported! (Most methods still need testing)

top 7 comments
sorted by: hot top controversial new old
[–] Hopps@lemmy.world 1 points 1 year ago

Thank you for sharing, going to check this out!

[–] usernotfound@lemmy.ml 0 points 1 year ago (1 children)

BTW, what's the difference between this and Pythörhead (apart from being easier to type? :p)

[–] travis@lemmy.blue 2 points 1 year ago (1 children)

From what I've seen, Pythorhead is focusing on "higher-level" functions, while Plemmy is focusing on LemmyHttp API parity and returning request responses. Who knows, maybe we'll implement some more complex functionality in the future!

[–] OnionFutures@vlemmy.net 2 points 1 year ago (2 children)

Hi there, thanks for working on this! One thing I am trying to do is write a script that fetches all of a particular user's subscribed communities (on any instance). It seems like a fairly simple thing but I can't seem to find any library that offers that functionality at the moment, unless I am missing something.

Another thing I'd like to be able to do is follow a community on a different instance to the user's local instance. I see Plemmy has a follow_community method but it's not clear if it allows following communities on different instances.

Are these things that Plemmy does or will support? It wasn't clear to me from the docs and am just wondering if Plemmy (or any existing library) will work for my use case.

[–] jnovinger@programming.dev 3 points 1 year ago* (last edited 1 year ago)

Looking at the LemmyHttp docs, mentioned above, it looks like you probably want to use the ListCommunities resource with the type_ ListingType of "Subscribed".

To do that with Plemmy, it looks like you want to use LemmyHttp(...).list_communities(type_='Subscribed').

Fair warning, I'm making this comment just from reading docs and source code, I haven't had a chance to try this yet.

[–] travis@lemmy.blue 1 points 1 year ago (1 children)

I'm not sure there's a way to interact with other Lemmy instances at the moment - clearly we can using the UI, but I think the API doesn't have the functionality yet. As soon as this and other features are added I'll aim for a quick implementation!

[–] OnionFutures@vlemmy.net 2 points 1 year ago

Interesting, thanks for the explanation. I thought it might be available as I can follow off-instance communities on Jerboa but I haven't dug into the source code there to see how they do it.