Skip to content

Instantly share code, notes, and snippets.

@JustinAzoff
Created March 24, 2009 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustinAzoff/83898 to your computer and use it in GitHub Desktop.
Save JustinAzoff/83898 to your computer and use it in GitHub Desktop.
minimal client for the solr REST api
from urllib2 import urlopen
from urllib import urlencode
import simplejson
class SolrSearcher:
def __init__(self, url):
self.url = url
def search(self, q, **kwargs):
args = {'q': q, 'wt': 'json'}
args.update(kwargs)
data = urlencode(args)
conn = urlopen(self.url, data)
rsp = simplejson.load(conn)
return rsp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment