Rate limit exceeded also with cached tweets each half an hour


#1

Hi, I developed a Wordpress theme and I sold about 400 copies of it. This WP theme has got a widget, I developed, to displays the recent tweets of a particular account, filled by the owner of the theme. The widget works fine for all of my clients, except for two of them, I don’t know why.

I cached the tweets, so the client makes only two requests per hour. The requests are stored in a static file and the user read the static file, so the requests can’t be more than 150 per hour, but this is what the static files returns since its first visit:

{“request”:"/1/statuses/user_timeline/themadmuseum.json?count=1000&include_rts=false",“error”:“Rate limit exceeded. Clients may not make more than 150 requests per hour.”}

What could it be? Maybe the domain name? This is one of the two domains: http://www.mechanicalmuseum.co.uk/

What should I check?

TIA

Manuel :slight_smile:


#2

The rate limiting is based off of IP address, so if they’re using a shared IP or host machine, it’s possible other API calls have exhausted the available number of API requests.

I’m not sure if WP themes allow including server-side code, but if possible, I would say you should allow users to configure oauth tokens in the theme and issue signed requests on their behalf. That way the rate limiting would only apply to the theme itself.


#3

Thank you, very kind, I’m trying to understand how the oauth works and it seems a labyrinth. Could you point me to the right direction? I only need that my clients, on their Wordpress installation, can read the last tweets from an account. They only type the account name and the number of posts to print on their website, they are not developers. And I should develop everything in PHP. It would be very, very kind

Manuel :slight_smile:


#4

For PHP I suggest using this library:

The code to fetch a timeline is pretty well covered here:
https://github.com/themattharris/tmhOAuth-examples/blob/master/entities.php

You’ll need to provide a way for site admins to configure a consumer key / access token, or allow them to “sign in” to your theme by following the oauth flow, which is shown here: https://github.com/themattharris/tmhOAuth-examples/blob/master/oauth_flow.php