lemmyland
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
maegul@hachyderm.io to Fediverse@lemmy.ml · 3 年前

Someone’s started a Python wrapper around the lemmy API

message-square
message-square
16
link
fedilink
88
message-square

Someone’s started a Python wrapper around the lemmy API

maegul@hachyderm.io to Fediverse@lemmy.ml · 3 年前
message-square
16
link
fedilink

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

alert-triangle
You must log in or # to comment.
  • db0@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    54
    ·
    3 年前

    Hey everyone, “someone” here, AMA :D

    • SwingingKoala@discuss.tchncs.de
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      edit-2
      2 年前

      deleted by creator

      • db0@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        15
        ·
        3 年前

        We have quite a few examples and the code is statically typed and well commented. I hope we can figure out an automatic doc creation system

    • Richard is a lemur@lemmy.ml
      link
      fedilink
      arrow-up
      6
      ·
      3 年前

      Do you like garlic bread?

      • db0@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        6
        ·
        3 年前

        very

    • makingStuffForFun@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      3 年前

      I’d love to write a bot for my own community. I used to use praw, when reddit was a thing.

      Can you see your wrapper being used this way? If so, is it ready for this yet? If so, is there any example code or docs on this?

      Thanks for your work, it’s very much appreciated.

      • db0@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        4
        ·
        3 年前

        Yes there isn’t a reason not to use it as a bot. We don’t have all the API endpoints yet as we add them usually as we need them, but if you need one we don’t have, just open a PR or send an issue and we’ll handle it.

    • Machefi@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      3 年前

      Where does the name come from and what’s going on on that logo?

      • db0@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        7
        ·
        3 年前

        Python + Motörhead and what do you mean?

        • maegul (he/they)@lemmy.ml
          link
          fedilink
          arrow-up
          9
          ·
          3 年前

          Where … for those who don’t know … Motörhead was band headed by a fellow named … “Lemmy” (who’s partly responsible for the name of this place!)

    • redrum@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      3 年前

      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
        link
        fedilink
        arrow-up
        2
        ·
        3 年前

        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

    • Machefi@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      3 年前

      (Sorry for repeating myself, my instance had a minor rollback)

      Where does the name come from and what’s going on on that logo? It looks like a snake with sunglasses, but I can’t locate it’s head or tail.

      • varaki@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        3 年前

        deleted by creator

  • Demigodrick@lemmy.zip
    link
    fedilink
    arrow-up
    10
    ·
    3 年前

    There is also plemmy https://github.com/tjkessler/plemmy

  • BrownPolarBear@lemmy.pt
    link
    fedilink
    arrow-up
    9
    ·
    3 年前

    “someone”

  • db0@hachyderm.io
    link
    fedilink
    arrow-up
    9
    ·
    3 年前

    @maegul @db0@lemmy.dbzer0.com @fediverse @fediversenews I’m also on hachyderm.io as well ;)

Fediverse@lemmy.ml

fediverse@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !fediverse@lemmy.ml

A community dedicated to fediverse news and discussion.

Fediverse is a portmanteau of “federation” and “universe”.

Getting started on Fediverse;

  • What is the fediverse?
    • Short ver.
    • Full ver.
  • Fediverse Platforms
  • How to run your own community
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 11 users / day
  • 105 users / week
  • 435 users / month
  • 1.67K users / 6 months
  • 1 local subscriber
  • 24.2K subscribers
  • 1.23K Posts
  • 16.2K Comments
  • Modlog
  • mods:
  • Sean Tilley@lemmy.ml
  • wakest@lemmy.ml
  • BE: 0.19.15
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org