Pythonlemmy: a Python package for accessing the Lemmy API
Pythonlemmy allows you to interact with any Lemmy instance using Python and the LemmyHttp API.
Pythonlemmy is a fork of plemmy that uses automatic code generation to keep the models and client as up to date as possible. The aim is to maintain an interface similar to plemmy.
WARNING: Pythonlemmy is still in development and needs testing!
Installation
A PyPI repository is updated whenever a new version is available:
python -m pip install pythonlemmy
Basic usage
Interact with a Lemmy instance using the LemmyHttp object:
from pythonlemmy import LemmyHttp
# create object for Lemmy.world, log in
srv = LemmyHttp("https://lemmy.world")
srv.login("<username_or_email>", "<password>")
Access specific communities:
from pythonlemmy.responses import GetCommunityResponse
# obtain community, parse JSON
api_response = srv.get_community(name="Lemmy")
response = GetCommunityResponse(api_response)
# community info
community = response.community_view.community
print(community.name)
print(community.actor_id)
print(community.id)
# list community moderators
for person in response.moderators:
print(person.moderator.name, person.community.name)
Create a post:
from pythonlemmy.responses import PostResponse
# create post, parse JSON
api_response = srv.create_post(community.id, "Test post please ignore", "Body text")
response = PostResponse(api_response)
# post info
post = response.post_view.post
print(post.creator_id)
print(post.community_id)
print(post.name)
print(post.body)
Full documentation is on its way, but in the meantime check out our source code and some examples.
Reporting issues, making contributions, etc.
Don't hesitate to report a bug or unexpected results! Want to contribute? Make a pull request.
Credits
Pythonlemmy is a fork of plemmy, and credit for the structure and supporting functionality goes to its authors. The client files (objects, views, responses, and lemmyhttp methods) are generated from parsing the source files of the lemmy-js-client project. Documentation is automatically generated using the lemmy_openapi_spec project.
Metadata
Release files for pythonlemmy 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pythonlemmy-0.3.0.tar.gz | 42.2 kB | Without provenance | Details for pythonlemmy-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pythonlemmy-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for pythonlemmy-0.3.0-py3-none-any.whl |
Total release size: 91.7 kB
Release files / pythonlemmy-0.3.0.tar.gz
| Download URL | pythonlemmy-0.3.0.tar.gz |
|---|---|
| Size | 42.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3084a0c53fe286e37be72c3f06b20e02a768d17cfdf1cf2b7fb8ba7557f09b4a
|
|
BLAKE2b-256 checksum How to use checksums |
4f461f1f29dd838a2b26d76f56f6f0ae6e6a81e4d2fec19423ba56794ebe16c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / pythonlemmy-0.3.0-py3-none-any.whl
| Download URL | pythonlemmy-0.3.0-py3-none-any.whl |
|---|---|
| Size | 49.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63baa9a50ff73f8aa3a10f30baac2ed657f582ec26944b9c0dfa95b18075c429
|
|
BLAKE2b-256 checksum How to use checksums |
ee39c1bebf3ffcfff906698c52778e42cadd7dbdc0b6dec9f655f6ce5c4ebdfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for pythonlemmy 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.