0

How can you tell when you trip the YQL api rate limiter?

Hi guys,

I'm working on a ruby app at the mo, and trying to get it to talk to YQL, in particular, geoplanet.

I want it to send a long complex name for a place, and get back the rough area (or as yahoo refers to it, 'locality1').

I've tested out the query in the yql console, and manually with curl, but when I try sending this request off to Yahoo from inside the app, I get back a 400 error.

Here's the code:

CODE
  def yql_name_hpricot(name)

# this method takes a place name, and returns the English name of the region it resides in.
# So 'Marnee La Valle Chessy' becomes 'Chessy', and 'London Kings Cross International' becomes 'London'

# 'name' is value pulled out of a database here

url_safe_name = name.gsub(" ", "%20")
yql = "http://query.yahooapis.com/v1/public/yql?"

# this snippet takes the query back
response = Hpricot.XML(open("#{yql}q=select%20locality1%20from%20geo.places%20where%20text%3D%22#{url_safe_name}%22"))

# Hpricot has an innerHTML method that plucks a value out of an xml feed, getting rid of any whitespace
response_name = response.innerHTML.strip

end


Is there anything obvious I'm missing here?

How could I check if I'm tripping the rate limiter here, or get more detailed info back to see what I'm doing wrong?

by
2 Replies
  • Its not a rate limiter issue, but let me see if some Ruby gurus can lend a hand.

    Jonathan
    0
  • Works for me in `irb`, but I had to `require 'open-uri'` (and `hpricot`) first. Can you paste the error message the YQL server is returning along with the 400?

    seth
    0

Recent Posts

in YQL