Skip to content

Instantly share code, notes, and snippets.

@kubrick06010
Created July 6, 2012 17:55
Show Gist options
  • Select an option

  • Save kubrick06010/3061627 to your computer and use it in GitHub Desktop.

Select an option

Save kubrick06010/3061627 to your computer and use it in GitHub Desktop.
use Net::Twitter;
$nt = Net::Twitter->new(
traits => ['API::REST', 'RetryOnError']
max_retries => 3,
);
use Net::Twitter;
my $nt = Net::Twitter->new(
traits => [qw/API::REST RateLimit/],
%other_options,
);
#...later
sleep $nt->until_rate(1.0) || $minimum_wait;
@kubrick06010
Copy link
Copy Markdown
Author

The Twitter API only allows clients to make a limited number of calls in a given hour. This policy affects the APIs in different ways.
REST API Rate Limiting

The default rate limit for calls to the REST API varies depending on the authorization method being used and whether the method itself requires authentication.

Unauthenticated calls are permitted 150 requests per hour. Unauthenticated calls are measured against the public facing IP of the server or device making the request.
OAuth calls are permitted 350 requests per hour and are measured against the oauth_token used in the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment