90
submitted 1 year ago by maegul@hachyderm.io to c/fediverse@lemmy.ml

Someone’s started a Python wrapper around the lemmy API

https://github.com/db0/pythorhead (@db0)

Could make writing bots and other tools easier and quicker.

@fediverse @fediversenews

you are viewing a single comment's thread
view the rest of the comments
[-] redrumBot@lemmy.ml 1 points 1 year ago

I think that this question from my non bot account has not reached you:

@carlesmu@lemmygrad.ml wrote:

Thanks for the wrapper :)

Two questions:

  1. Where can I find the relation between languages and the languages_id ints?

  2. When I log in into a lemmy instance I check the protected member _requestor.nodeinfo to detect if the problem it’s the connection or the user/password:

     lemmy = Lemmy(instance)
    
     if not lemmy.log_in(user, password):
         if not lemmy._requestor.nodeinfo:
             raise LemmyException(f"Sorry, cannot connect to lemmy instance {instance}.")
         raise LemmyException(
             f"Sorry, cannot login {user} into {instance}. Bad user or wrong password."
         )
    

    There is a better way to validate it?

[-] db0@lemmy.dbzer0.com 2 points 1 year ago

I believe pythorhead writes a specific log when you try too login to a non python instance. The node info likewise has a function to retrieve it

this post was submitted on 28 Jun 2023
90 points (97.9% liked)

Fediverse

17538 readers
4 users here now

A community dedicated to fediverse news and discussion.

Fediverse is a portmanteau of "federation" and "universe".

Getting started on Fediverse;

founded 4 years ago
MODERATORS