Closed orzechowska closed 1 year ago
@orzechowska you could try my way, found in chromium requests. Maybe authors will finally adapt thehive4py to new hive version...
# observables = self.hive_api.get_case_observables(hive_case_id, query=In('dataType', ['mail']))
observables = requests.post(self.hive_api.url+'/api/v1/query?name=observables', json={"query":[{"_name":"getCase","idOrName":hive_case_id},{"_name":"observables"},{"_name":"filter","_like":{"_field":"dataType","_value":"mail"}}]}, proxies=self.hive_api.proxies, auth=self.hive_api.auth)
I've just hit the same error executing the find_alerts()
method.
Here below the full stack trace
warnings.warn(
2021-10-12 11:12:34,174 - TheHive - ERROR:Failed to execute Error: ('Connection broken: IncompleteRead(34 bytes read)', IncompleteRead(34 bytes read))-963e5141-120a-451d-a081-067230bb0a88
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 697, in _update_chunk_length
self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b'HTTP/1.1 503 Service Unavailable\r\n'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 437, in _error_catcher
yield
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 764, in read_chunked
self._update_chunk_length()
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 701, in _update_chunk_length
raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(34 bytes read)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 753, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 572, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 793, in read_chunked
self._original_response.close()
File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.9/site-packages/urllib3/response.py", line 455, in _error_catcher
raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(34 bytes read)', IncompleteRead(34 bytes read))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/thehive4py/api.py", line 120, in __find_rows
return requests.post(req, params=params, json=data, proxies=self.proxies, auth=self.auth, verify=self.cert)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 697, in send
r.content
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 831, in content
self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 756, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(34 bytes read)', IncompleteRead(34 bytes read))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/walkoff_app_sdk/app_base.py", line 2556, in execute_action
newres = await func(**params)
File "/app/app.py", line 67, in find_best_case_to_merge
response = self.thehive.find_alerts(query=query)
File "/usr/local/lib/python3.9/site-packages/thehive4py/api.py", line 1053, in find_alerts
return self.__find_rows("/api/alert/_search", **attributes)
File "/usr/local/lib/python3.9/site-packages/thehive4py/api.py", line 122, in __find_rows
raise TheHiveException("Error: {}".format(e))
thehive4py.exceptions.TheHiveException: Error: ('Connection broken: IncompleteRead(34 bytes read)', IncompleteRead(34 bytes read))
Could be something related to this one https://github.com/psf/requests/issues/4248?
The same issue hear. Need to immediately fix.
Request Type
Bug
Work Environment
Problem Description
When calling find_observables method I get the following error:
find_cases()
andfind_alerts()
both work without issue.Steps to Reproduce
I tired different query parameters, nothing seems to work. I would appreciate any help with solving this issue.