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

Lemmy

12542 readers
92 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 4 years ago
MODERATORS
 

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: https://codeberg.org/retiolus/Lemmy.py

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.")
you are viewing a single comment's thread
view the rest of the comments
[–] chris@l.roofo.cc 1 points 1 year ago

Did you write the wrapper by hand or did you use a tool?