#13 new

Search API access?

Reported by pjammer | April 5th, 2009 @ 10:17 AM

maybe i'm missing something, but the code looks as if i can only specify one base_url in the twitter_auth.yml file.

To extend this gem to use both the REST API and the Search API, should i:

First add a :search_url = "http://search.twitter.com/search" to the twitter_auth.yml file.

Second extend twitter_auth.rb to include the following:

  def self.base_url
    config['base_url'] || 'https://twitter.com'    
  #trying out the search_url here
  def self.search_url
    config['search_url'] || 'https://twitter.com' 
  def self.path_prefix
  #adding search path prefix here
  def self.search_path_prefix

notice the commented version differs from you code.

Also in twitter_auth.rb i'd need to tweek these methods as well

  def self.consumer
      :site => TwitterAuth.base_url

  def self.net
    uri = URI.parse(TwitterAuth.base_url)
    net = Net::HTTP.new(uri.host, uri.port)
    net.use_ssl = uri.scheme == 'https'
    net.read_timeout = TwitterAuth.api_timeout

Or is there another way you intended for using the search api? Please advise.

Comments and changes to this ticket

  • Michael Bleigh

    Michael Bleigh April 5th, 2009 @ 02:03 PM

    The Search API doesn't require authentication, so anyone can use it just by making straight-up Net::HTTP calls. I may add this functionality to the dispatcher sometime soon (in fact, I may break out the dispatcher into a separate gem), but you should be able to access the search API without much trouble regardless.

  • pjammer

    pjammer April 5th, 2009 @ 08:34 PM

    thanks, i learned something new again :-)

    Appreciate the reply. I wonder if you could make the fancy methods for the search api regardless? +1 for that functionality.


Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A full-stack authentication system for Rails that uses Twitter.

People watching this ticket