You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2007/03/09 22:36:59 UTC

[Solr Wiki] Update of "SolPython" by IanBicking

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.
+