# Python API unhandled exception

**URL:** <https://discuss.elastic.co/t/python-api-unhandled-exception/54072>\
**Category:** Elasticsearch\
**Created:** [June 27, 2016, 7:36pm UTC](https://discuss.elastic.co/t/python-api-unhandled-exception/54072 "2016-06-27T19:36:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pinhasr](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pinhasr](https://discuss.elastic.co/u/pinhasr)\
**Post date:** [June 27, 2016, 7:36pm UTC](https://discuss.elastic.co/t/python-api-unhandled-exception/54072/1 "2016-06-27T19:36:17Z")

</div>

Hi can any body know how to catch this exception  
it some time happen and same time not at mode debug it not happen

thanks

GET [http://db1:9200/vg-signals/signal/\_search?from=0&fields=si\_id%2Csi\_coordination\_points%2Csi\_sig\_hash%2Csi\_expert%2Csi\_host\_id%2Csi\_signal\_type%2Csi\_sha1%](http://db1:9200/vg-signals/signal/_search?from=0&fields=si_id%2Csi_coordination_points%2Csi_sig_hash%2Csi_expert%2Csi_host_id%2Csi_signal_type%2Csi_sha1%25)  
2Csi\_size%2Csi\_record\_create\_time%2Csignal\_shape%2Csi\_task\_id%2Csi\_sts16&size=1000 [status:N/A request:0.094s]  
Traceback (most recent call last):  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 595, in urlopen  
chunked=chunked)  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 393, in \_make\_request  
six.raise\_from(e, None)  
File "", line 2, in raise\_from  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 389, in \_make\_request  
httplib\_response = conn.getresponse()  
File "/usr/lib/python3.4/http/client.py", line 1171, in getresponse  
response.begin()  
File "/usr/lib/python3.4/http/client.py", line 351, in begin  
version, status, reason = self.\_read\_status()  
File "/usr/lib/python3.4/http/client.py", line 315, in \_read\_status  
raise LineTooLong("status line")  
http.client.LineTooLong: got more than 65536 bytes when reading status line

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File "/usr/local/lib/python3.4/dist-packages/elasticsearch/connection/http\_urllib3.py", line 94, in perform\_request  
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, \*\*kw)  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 640, in urlopen  
\_stacktrace=sys.exc\_info()[2])  
File "/usr/local/lib/python3.4/dist-packages/urllib3/util/retry.py", line 238, in increment  
raise six.reraise(type(error), error, \_stacktrace)  
File "/usr/local/lib/python3.4/dist-packages/urllib3/packages/six.py", line 685, in reraise  
raise value.with\_traceback(tb)  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 595, in urlopen  
chunked=chunked)  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 393, in \_make\_request  
six.raise\_from(e, None)  
File "", line 2, in raise\_from  
File "/usr/local/lib/python3.4/dist-packages/urllib3/connectionpool.py", line 389, in \_make\_request  
httplib\_response = conn.getresponse()  
File "/usr/lib/python3.4/http/client.py", line 1171, in getresponse  
response.begin()  
File "/usr/lib/python3.4/http/client.py", line 351, in begin  
version, status, reason = self.\_read\_status()  
File "/usr/lib/python3.4/http/client.py", line 315, in \_read\_status  
raise LineTooLong("status line")  
urllib3.exceptions.ProtocolError: ('Connection aborted.', LineTooLong('got more than 65536 bytes when reading status line',))

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [July 5, 2016, 9:38am UTC](https://discuss.elastic.co/t/python-api-unhandled-exception/54072/2 "2016-07-05T09:38:25Z")

</div>

Hi,

this is not really Python related. See the last line of the error message:

> got more than 65536 bytes when reading status line

This means that Elasticsearch sent back a very long HTTP status line. You can try to issue the same request with curl and then check what the status line says.

Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:38pm UTC](https://discuss.elastic.co/t/python-api-unhandled-exception/54072/3 "2017-07-05T22:38:06Z")

</div>


