Skip to content

Rate Limits #7

Open
Open

Description

@thedavecarroll

Each Twitter API endpoint has a specific rate limit for the standard API.

You can find more information on Twitter's standard API rate limiting here.

For instance, here are the rate limits for lists endpoints.

/lists/list             : @{limit=15; remaining=0; reset=1552260236}
/lists/memberships      : @{limit=75; remaining=75; reset=1552260742}
/lists/subscribers/show : @{limit=15; remaining=15; reset=1552260742}
/lists/members          : @{limit=900; remaining=900; reset=1552260742}
/lists/subscriptions    : @{limit=15; remaining=15; reset=1552260742}
/lists/show             : @{limit=75; remaining=75; reset=1552260742}
/lists/ownerships       : @{limit=15; remaining=15; reset=1552260742}
/lists/subscribers      : @{limit=180; remaining=180; reset=1552260742}
/lists/members/show     : @{limit=15; remaining=15; reset=1552260742}
/lists/statuses         : @{limit=900; remaining=900; reset=1552260742}

After reaching the limit, the current Invoke-TwitterAPI calling function generates an error similar to the following:

Invoke-RestMethod : {"errors":[{"message":"Rate limit exceeded","code":88}]}
At C:\Program Files\PowerShell\Modules\PSTwitterAPI\0.0.7\public\Invoke-TwitterAPI.ps1:34 char:5
+     Invoke-RestMethod @RestMethod_Params
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Method: GET, Re...rShell/6.1.2
}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

How should rate limits be handled?

Activity

  1. mkellerman commented on Mar 15, 2019

    @mkellerman

    Inside each Public function for each endpoint, you'll notice that there is this line:
    If (-Not $OAuthSettings) { $OAuthSettings = Get-TwitterOAuthSettings -Resource $Resource }

    Get-TwitterOAuthSettings searches all the configured OAuthSettings for a resource that is available. And will rotate between all the APIKeys, allowing you to surpass the limits on once single Twitter API Application, by adding multiple APIKeys.

    If none are found, it's going to generate this Rate limit exceeded, but in reality, we should simply 'Wait' for one to be available again.

    View the current issue here:
    mkellerman#12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions