heiseonline / shariff-backend-php

👮 PHP backend for Shariff. Shariff enables website users to share their favorite content without compromising their privacy.
http://ct.de/-2467514
134 stars 44 forks source link

[Reddit] 429 Too Many Requests #119

Closed core23 closed 7 years ago

core23 commented 7 years ago

When using the shariff backend in my project, I got many Guzzle warnings in my log:

[2017-02-26 17:41:22] app.WARNING: Client error: `GET https://www.reddit.com/api/info.json?url=https%3A%2F%2Fexample.com` resulted in a `429 Too Many Requests` response: {"message": "Too Many Requests", "error": 429}  {"exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 429): Client error: `GET https://www.reddit.com/api/info.json?url=https%3A%2F%2Fexample.com` resulted in a `429 Too Many Requests` response:\n{\"message\": \"Too Many Requests\", \"error\": 429}\n at /www/htdocs/***/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111)"} []
[2017-02-26 17:41:22] app.WARNING: Client error: `GET https://www.reddit.com/api/info.json?url=https%3A%2F%2Fexample.com` resulted in a `429 Too Many Requests` response: {"message": "Too Many Requests", "error": 429}  {"exception":"[object] (GuzzleHttp\\Exception\\ClientException(code: 429): Client error: `GET https://www.reddit.com/api/info.json?url=https%3A%2F%2Fexample.com` resulted in a `429 Too Many Requests` response:\n{\"message\": \"Too Many Requests\", \"error\": 429}\n at /www/htdocs/***/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111)"} []

It looks like the reddit api is blocking anonymous api requests.

Maybe we should find a way to modify the user agent to get through the reddit spam protection.

compeak commented 7 years ago

We would welcome a pull request.