lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "SolPython" by IanBicking
Date Fri, 09 Mar 2007 21:36:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by IanBicking:
http://wiki.apache.org/solr/SolPython

------------------------------------------------------------------------------
    print 'name field =', doc['name']
  }}}
  
+ == Using normal JSON ==
+ 
+ Using {{{eval}}} is generally considered bad form and dangerous in Python.  In theory if
you trust the remote server it is okay, but if something goes wrong it means someone can run
arbitrary code on your server (attacking eval is very easy).
+ 
+ It would be better to use a Python JSON library like [http://undefined.org/python/#simplejson
simplejson].  It would look like:
+ 
+ {{{
+ from urllib2 import *
+ import simplejson
+ conn = urlopen('http://localhost:8983/solr/select?q=iPod')
+ rsp = simplejson.load(conn)
+ ...
+ }}}
+ 
+ Safer, and as you can see, easy.
+ 

Mime
View raw message