Git Product home page Git Product logo

Comments (5)

halcy avatar halcy commented on June 8, 2024

Hi! v2 instance API is WIP currently, and the next release will have it, though I am currently busy with other projects, so it'll be a bit before I can get back to that. Think something like mid to end August, hopefully. I've also considered adding a character counting helper that would help with that, but that's after that, even.

That said: The v1 API that mastodon.py fetches current should include that. See, for example:

https://icosahedron.website/api/v1/instance

Under configuration.statuses, there is the information you'd want. Though also, only for recent versions, not sure at which it starts. Some software and patches will have exposed it as part of nodeinfo instead. It is a bit of a mess, which I would like to try to abstract away for this specific use case, which is why see above.

What instance are you trying to get that information from?

from mastodon.py.

jeancf avatar jeancf commented on June 8, 2024

I wasn't aware of the v1 and v2 distinction of the API.

What instance are you trying to get that information from?

I am interested in getting max_characters from any instance (this is for integration in a bot that can run anywhere).

The v1 API that mastodon.py fetches current should include that

Are you saying that that a call to Mastodon.instance() returns the contents of the JSON object returned by api/v1/instance?. The documentation for the Instance Dict looks more limited and does not include max_characters.

If not, I can fetch the data from api/v1/instance directly but it would be nice to have it through Mastodon.py.

Thanks.

from mastodon.py.

halcy avatar halcy commented on June 8, 2024

It does return that! The documentation is out of date somewhat - earlier versions of Mastodon did not include the "configuration" part, and I haven't updated docs to reflect that it now does. I am trying to fix all of that, but I've been bogged down somewhat. The next version will have much better and more up to date (and also more easily updateable) documentation.

You should be able to just call mastodon.instance().configuration.statuses to get the status info - if the instance is new enough. If you do that, probably wrap it in a try -> except statement and assume that if it fails, value is masto default of 500.

from mastodon.py.

jeancf avatar jeancf commented on June 8, 2024

Sound good! I should have tried calling mastodon.instance() and look at the result.

Anyway, keep up with the effort that you put behind Mastodon.py, it is well worth it. Thanks!

from mastodon.py.

halcy avatar halcy commented on June 8, 2024

closing resolved

from mastodon.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.