Skip to content

Getting error 429 Too Many Requests #23

@andywise0

Description

@andywise0

I'm listening to a filtered stream and most of the time its working just fine but every now and again the process falls over reporting a 429 Too Many Requests error with the message:-
Fatal error: Uncaught Felix\TwitterStream\Exceptions\TwitterException: Should not happen: please open an issue at https://github.com/felixdorn/twitter-stream-api/issues

I'm not sure what additional data (error say (include the payload) but I' not sure what you mean by payload - the header does imply a rate limit issue (see below)

I may well be hitting a twitter rate limit - please recommend how to monitor this and back off (pause) from my code when the rate limit is near zero.

Thanks, Andy

Header from request....

-response: GuzzleHttp\Psr7\Response^ {fennb#29
-reasonPhrase: "Too Many Requests"
-statusCode: 429
-headers: array:20 [
"date" => array:1 [
0 => "Mon, 27 Mar 2023 12:05:34 UTC"
]
"perf" => array:1 [
0 => "7626143928"
]
"server" => array:1 [
0 => "tsa_f"
]
"set-cookie" => array:1 [
0 => "guest_id=v1%3A167991873459084802; Max-Age=34214400; Expires=Fri, 26 Apr 2024 12:05:34 GMT; Path=/; Domain=.twitter.com; Secure; SameSite=None"
]
"content-type" => array:1 [
0 => "application/json; charset=utf-8"
]
"cache-control" => array:1 [
0 => "no-cache, no-store, max-age=0"
]
"content-length" => array:1 [
0 => "213"
]
"x-access-level" => array:1 [
0 => "read"
]
"x-frame-options" => array:1 [
0 => "SAMEORIGIN"
]
"x-transaction-id" => array:1 [
0 => "c12bee64dd78178f"
]
"x-xss-protection" => array:1 [
0 => "0"
]
"x-rate-limit-limit" => array:1 [
0 => "40000"
]
"x-rate-limit-reset" => array:1 [
0 => "1679919634"
]
"content-disposition" => array:1 [
0 => "attachment; filename=json.json"
]
"x-content-type-options" => array:1 [
0 => "nosniff"
]
"x-rate-limit-remaining" => array:1 [
0 => "39999"
]
"strict-transport-security" => array:1 [
0 => "max-age=631138519"
]
"x-response-time" => array:1 [
0 => "119"
]
"x-connection-hash" => array:1 [
0 => "58b90e5982e8edcc2f168c96018fcd8402b71aee4ab376bc85b09d912d816014"
]
"connection" => array:1 [
0 => "close"
]
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions