Twitte...imiting(3pm)

πŸ’– NAME πŸ’–

Twitter::API::Trait::RateLimiting β€” the trait that just auto-naps for you when the API says "girl, slow down." No cap, it handles rate limiting so you don't have to.


✨ VERSION ✨

version 1.0006 πŸŽ€


🌸 SYNOPSIS 🌸

use Twitter::API;

my $client = Twitter::API->new_with_options(
    traits => [ qw/ApiMethods RateLimiting/ ],
    %other_options,
);

# Use $client as normal

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, here's the tea 🍡: Twitter's API does its rate limiting inside a 15-minute window, and if you blow past the limit for a window, it just serves you up an HTTP 429 error. rude, honestly.

Applying this trait gives Twitter::API the power to automatically sleep for as long as it needs to, and then retry the request β€” instead of just throwing an exception at you like some drama queen. it's giving considerate πŸ’…


πŸ’œ ATTRIBUTES πŸ’œ

🌈 rate_limit_sleep_code

A coderef 🫢 β€” it gets called to actually do the sleeping. It takes a single parameter: the number of seconds to sleep.

The default implementation is iconic and tiny:

sub { sleep shift }

πŸ‘‘ SEE ALSO πŸ‘‘

<https://developer.twitter.com/en/docs/basics/rate-limiting>


🌟 AUTHOR 🌟

Marc Mims <marc@questright.com> πŸ’–


This software is copyright (c) 2015-2021 by Marc Mims.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


πŸ’« that's the whole page, bestie. this doc was living in perl v5.32.1 territory, dated 2021-09-11 β€” shoutout to the User Contributed Perl Documentation crew for keeping the vibe alive. mwah, bye πŸ§šπŸ’…
πŸ“¦ where this page comes from