Skip to main content

A python wrapper for the lemmy HTTP API. Forked from plaw by Benjamin Jablonski (benja810)

Project description

Python Lemmy API Wrapper

Build Generate Python Documentation

Like PRAW but for Lemmy

Written using the Lemmy TS library for reference.

Forked from benja810's plaw

Currently, most of the API functions are implemented, but there are likely quite a few bugs. It is a bit difficult to test at the moment without spinning up a new instance.

If you find any bugs, let me know on the issues page

Installation

jplaw can be installed from PYPI through pip:

python -m pip install jplaw

From source

Building can use the script build_and_install:

sh ./build_and_install.sh

Or build and install manually for version {version}:

py -m build
py -m pip install ./dist/jplaw-{version}.tar.gz

Usage example

This example uses python-dotenv to load secrets from the .env file, which is not strictly necessary.

import jplaw
import dotenv

#Load secrets with dotenv
dotenv.load_dotenv()
my_instance = os.getenv("LEMMY_INSTANCE")
my_username = os.getenv("LEMMY_USERNAME")
my_password = os.getenv("LEMMY_PASSWORD")

lem = jplaw.Lemmy(my_instance, my_username, my_password)

#Print the JSON response from the community list
print(lem.Community.list())

#Print the JSON response from getting a specific community
print(lem.Community.get("test@lemmy.ml"))

Documentation

See the documentation for more information on how to use jplaw.

Roadmap

  • Work on return types and usability.
  • Work on testing functions and finding / squashing bugs

Changelog

v0.1.10

  • Fix getting comments (thanks to @notBradPitt)
  • Add Controversial sorting to comments and posts
  • Add infinite scrolling option to user settings
  • Fix build script issues for non-single digit major/minor versions
  • Add Moderator View to listing type
  • Fix federateCommunity indexing

v0.1.9

  • Add blur_nsfw and auto_expand parameters to saveUserSettings
  • Add moderator_view parameter to Post.list()

v0.1.8

  • Fixes Community.edit()
  • Adds Lemmy.federateCommunity()

v0.1.7

  • Fix bug with "fixed" boolean values

v0.1.6

  • Fixes boolean and Enum parameters
  • Adds show_nsfw to communities
  • Add open_links_in_new_tab saveUserSettings
  • Removes auth_token parameter from functions. To get an auth_token, a new Lemmy object can be created and logged in with. Accessing other instances via a Lemmy object can be done via the instance parameter, but does not authenticate
  • Fix documentation for jplaw.types and jplaw.comment

v0.1.5

  • Fix namespace issues
  • Fix build issues
  • Fix missing instance argument in list communities

v0.1.4

  • Created documentation
    • Versioned documentation for browsing info on previous versions (things will prob change pretty quickly in early releases)
    • Available here
  • Fixed some issues with argument types not using enums properly or missing references
  • Created Emoji class for creating, editing and deleting custom emoji

v0.1.3

  • Moved enums like SortType to submodule jplaw.types
  • Fix missing enum types
  • Rename a large portion of the functions to remove repetition.
    • Decouples naming scheme from Lemmy API
    • Shortens names and removes repetitive naming like "Lemmy.Comment.likeComment()" -> "Lemmy.Comment.like()."

v0.1.2

  • Added majority of the API functions except for image uploading

v0.1.1

  • Getting PyPi package working and added some functions

v0.1

  • Alpha release. After forking from plaw, fork was broken and migrated to this repository from the jplaw repository, as I wanted to do something a little different from having a purely API equivalent library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jplaw-0.1.10.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jplaw-0.1.10-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file jplaw-0.1.10.tar.gz.

File metadata

  • Download URL: jplaw-0.1.10.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for jplaw-0.1.10.tar.gz
Algorithm Hash digest
SHA256 36bd8048cc13da8442a331dbbec4d1912c41c57c8353119fdb5a1548b5b62f0f
MD5 5fa4daab3398dd28e02fecfff8ee388d
BLAKE2b-256 e12c644d90b7be1085c999938056a669df664ac47c4036a47ad6ef9e1256f8d3

See more details on using hashes here.

File details

Details for the file jplaw-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: jplaw-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for jplaw-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 dbdcf6cf3f44dcb07860bd168d072607e5ea0a7f0ab4a3b3cf92e895e886fd2f
MD5 aa9a2108f1ad7e80690237db8170e447
BLAKE2b-256 062bebd7165c00302635728ec916fea2366ed83c652146a8cfdbd0f2527e693c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page