Created
March 24, 2009 02:35
-
-
Save JustinAzoff/83898 to your computer and use it in GitHub Desktop.
minimal client for the solr REST api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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