Twitter::API::Trait::RateLimiting(3pm)

Twitter::API::Trait::RateLimiting3pm

Automatically sleep as needed to handle rate limiting

Usage

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

Version

version 1.0006

Overview

Twitter's API implements rate limiting in a 15-minute window, and will serve up an HTTP 429 error if the rate limit is exceeded for a window. Applying this trait will give Twitter::API the ability to automatically sleep as much as is needed and then retry a request instead of simply throwing an exception.

Attributes

rate_limit_sleep_code

A coderef, called to implement sleeping. It takes a single parameter - the number of seconds to sleep. The default implementation is:

    sub { sleep shift }

Releases

4 releases since Debian 10 (Buster); the text changed 1 time.

  1. 10–11
  2. 12–13

Author

Marc Mims <[email protected]>

From libtwitter-api-perl 1.0006-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.