Hello, I tried to use this Python sample code but found that this code would raise UnicodeEncodeError, and this is because my query includes special characters that can't be encoded by 'ascii' codec. This is because your baseline code for Python uses urllib package and this urllib can only handle ASCII requests.
So, I'd recommend to change this urllib-based scripts to simple requests package, which can handle those kind of special characters. If you don't mind, I can pull request those part after fork this code. If there is a reason to use urllib, then never mind on my issue. Thanks!