Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Anyone looking at Mastodon::Client?

by Cody Fendant (Hermit)
on Dec 17, 2022 at 06:57 UTC ( #11148935=perlquestion: print w/replies, xml ) Need Help??

Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:

Mastodon is becoming very much more popular for obvious reasons and I can't get Mastodon::Client to work.

The module is pretty old, and asks for help with an updated API, and when I try to write a simple "hello world" I get an error 404 as soon as it tries to obtain a token from the version 1 API.

Just wondering if anyone is working on it? I'll try to figure out what's missing/changed but it might take me a while

Replies are listed 'Best First'.
Re: Anyone looking at Mastodon::Client?
by cavac (Vicar) on Dec 19, 2022 at 10:22 UTC

    Well, my bot does it something like this:

    print "Connecting to Mastodon...\n"; my $client = Mastodon::Client->new( instance => $config->{server}, name => 'TotallyLegitBot', client_id => $config->{key}, client_secret => $config->{secret}, access_token => $config->{token}, coerce_entities => 1, ); print "Posting message...\n"; $client->post_status('Dear Sir! I am prince Bob of Nigeria and i have +an offer for you...');

    Hope that helps.

    EDIT: For authentication, i went to my Mastodon account to Preferences/Development, clicked on "New Application", filled in application name and clicked submit. Then click the link with that application again and you get key+secret+token that you give your application. There are probably other ways to authorize it, but that's the one i found works without problems and with the least fuzzing about.

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

      Oh that's great, it works the way you do it. Maybe I misunderstood the workflow. I thought I needed to authorise as a user in the Perl in another step. Thanks!

        There probably is another, more sleek way. Similar on how Twitter does it, when a "do you want to authorize this app" page pops up. And no, couldn't get that to work on Twitter or Mastodon.

        Still using the old Net::Twitter classes for that stuff. Didn't feel the need to upgrade my code when upgrading will probably take longer than the remaining livetime of our formerly beloved social media platform.

        PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11148935]
Approved by Athanasius
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2023-05-29 21:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?