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
jplaw can be installed from PYPI through pip:
python -m pip install jplaw
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
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("[email protected]"))
See the documentation for more information on how to use jplaw.
- Work on return types and usability.
- Work on testing functions and finding / squashing bugs
- 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
- Add blur_nsfw and auto_expand parameters to saveUserSettings
- Add moderator_view parameter to Post.list()
- Fixes Community.edit()
- Adds Lemmy.federateCommunity()
- Fix bug with "fixed" boolean values
- 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
- Fix namespace issues
- Fix build issues
- Fix missing instance argument in list communities
- 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
- 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()."
- Added majority of the API functions except for image uploading
- Getting PyPi package working and added some functions
- 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.