This is an automated email from the ASF dual-hosted git repository. janhoy pushed a commit to tag history/branches/lucene-solr/branch_7_1 in repository https://gitbox.apache.org/repos/asf/solr.git
commit 2ce8e5c489d5729c48ac4ac4343e30e54653f38d Author: Cassandra Targett <[email protected]> AuthorDate: Thu Oct 19 15:41:38 2017 -0500 SOLR-11319: bring python with json docs up to date. This closes #243 --- solr/solr-ref-guide/src/using-python.adoc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/solr/solr-ref-guide/src/using-python.adoc b/solr/solr-ref-guide/src/using-python.adoc index 2c51486..732cd22 100644 --- a/solr/solr-ref-guide/src/using-python.adoc +++ b/solr/solr-ref-guide/src/using-python.adoc @@ -51,21 +51,16 @@ for document in response['response']['docs']: == Python with JSON -JSON is a more robust response format, but you will need to add a Python package in order to use it. At a command line, install the simplejson package like this: +JSON is a more robust response format, and Python has support for it in its standard library since version 2.6. -[source,bash] ----- -sudo easy_install simplejson ----- - -Once that is done, making a query is nearly the same as before. However, notice that the wt query parameter is now json (which is also the default if not wt parameter is specified), and the response is now digested by `simplejson.load()`. +Making a query is nearly the same as before. However, notice that the `wt` query parameter is now `json` (which is also the default if no `wt` parameter is specified), and the response is now digested by `json.load()`. [source,python] ---- from urllib2 import * -import simplejson +import json connection = urlopen('http://localhost:8983/solr/collection_name/select?q=cheese&wt=json') -response = simplejson.load(connection) +response = json.load(connection) print response['response']['numFound'], "documents found." # Print the name of each document.
