views:

764

answers:

3

Hi.

I am writing a twitter app using jtwitter - and its running inside a server inside my work. Anyway - whenever i run it from work it returns the error below and I am only making a couple requests per hour:

HTTP/1.1 400 Bad Request
{"request":"/1/statuses/user_timeline.json?count=6&id=cicsdemo&","error":"Rate limit exceeded. Clients may not make more than 150 requests per hour."} ]
2010-06-03 18:44:49 zero.timer.TimerTask::run Thread-3
    SEVERE [ CWPZA3100E: Exception during processing for timer task, "twitterTimer". Exception: java.lang.ClassCastException: winterwell.jtwitter.Twitter$Status incompatible with java.lang.String ]

I run the same code from home - its fine.

So obviously at some point twitter thinks our work is all coming from one direct IP - which is why its hitting a limit which it shouldnt.

Do I have any choice or workaround - can i make the limit be counted from my direct machine IP - or to my account instead of IP? Can i use a proxy? Has any body else had this problem and solved it?!

Before anyone asks the APP must live inside my work - it cannot run anywhere else!

Cheers,

Andy

+2  A: 

You can ask Twitter to move up that limit up to 20000 requests per hour. It's a pretty straightforward process documented on their site.

Pablo Santa Cruz
+6  A: 

Authenticate against an account so that you're using the account's API request limit, not the unauth'd IP limit:

http://dev.twitter.com/pages/rate-limiting

http://dev.twitter.com/pages/auth

If you still have issues, you can ask for whitelisting of the company IP, but for what you're talking about (only a few requests an hour), just auth'ing to an account is the best option.

Amber
This looks good - but the callback URL wouldnt be publicly available which ruins this scheme as I cannot do the authentication manually.How annoying - what does that leave me with?
RenegadeAndy
A: 

You could also consider using their streaming api which is much better(realtime). It will also take care of the limit, because you will only have a request when new data arrives.

Alfred