es-monitor icon indicating copy to clipboard operation
es-monitor copied to clipboard

Python URLAttrib2 error

Open jasirgit opened this issue 6 years ago • 0 comments

Hi Taowen,

I am getting error while executing my code(Code is given below). I am using python 2.7. Please help me to solve the issue.

Code

import es_sql test = es_sql.execute_sql('http://127.0.0.1:9200', 'select city from mtmaster where city = "Leon"')

Error:

Traceback (most recent call last): File "C:/Users/User/PycharmProjects/Practice/elasticsearch_sql.py", line 2, in test = es_sql.execute_sql('http://127.0.0.1:9200', 'select city from mtmaster where city = "Leon"') File "C:\Python27\lib\site-packages\es_sql\es_query.py", line 43, in execute_sql result_map['result'] = create_executor(current_sql_selects, result_map).execute(es_url, arguments) File "C:\Python27\lib\site-packages\es_sql\executors\select_from_leaf_executor.py", line 35, in execute response = select_from_system.execute(es_url, self.sql_select) or search_es(url, self.request, arguments) File "C:\Python27\lib\site-packages\es_sql\executors\select_from_leaf_executor.py", line 109, in search_es resp = urllib2.urlopen(url, json.dumps(request)).read() File "C:\Python27\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Python27\lib\urllib2.py", line 435, in open response = meth(req, response) File "C:\Python27\lib\urllib2.py", line 548, in http_response 'http', request, response, code, msg, hdrs) File "C:\Python27\lib\urllib2.py", line 473, in error return self._call_chain(*args) File "C:\Python27\lib\urllib2.py", line 407, in _call_chain result = func(*args) File "C:\Python27\lib\urllib2.py", line 556, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 406: Not Acceptable

Would be great to know if this might support Python 3?

jasirgit avatar Nov 13 '18 10:11 jasirgit