I’m currently setting up a Python wrapper for Lemmy’s API, my aim being to develop a moderation bot (more info here), so I’m building the wrapper as the bot requests it.

It’s my first time doing this, so don’t hesitate to contribute if you find it useful.

Usage example:

from lemmy import Lemmy

# Login to your account
lemmy = Lemmy("https://lemmy.ml")
lemmy.log_in("username_or_email", "password")

# Get a community ID
community_id = lemmy.discover_community("community_name")

# Get all posts from a community by ID
community_posts = lemmy.post.list(community_id=community_id)

# Get the modlog of your server
modlog = lemmy.modlog.get()

# Post a new publication on a community
lemmy.post.create(community_id=community_id, name="First Post!", body="This is the first community post.")
  • chrisA
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    The internet is always by our side