Python library search.get_json function error
complete
Illia Zub
complete
This was fixed a few months ago after the release of https://pypi.org/project/google-search-results/2.0.0/.
Joel Hull
The definition of JSON is a text format. IMHO, A function called get_json should probably return a text type JSON object not a dict. There is a get_dict function if you want a dict.
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.
Julien Khaleghy
I think this is on purpose? We can add a
search. get_raw_json
to allow clients to ask for the the raw string?Bart
in progress
Elizabeth Oster
planned
Victor Bernabia
Elizabeth Oster: here we are following Python JSON library behavior.
>> import json
>>> r = json.loads('{"bar":["baz", null, 1.0, 2]}')
>>> type(r)
<type 'dict'>
From a pure computer science you're correct. But from a practical scripting language python/perl/ruby approach is always easier to work with an object.
I'm adding "get_raw_json" in the library but "get_results" is already available.
-- Victor
Victor Bernabia
New Python library out.