post https://example.com/qapi/searches
Run a synschronous GLOBAL or LOCAL search according to the provided user timeout.
Each time a result is available it will be returned as a chunk. The last chunk is always a timemout error.
import requests
[...]
with requests.post('http://localhost:8081/searches'), stream=True, headers=headers,
params={'scope': CommonScope.LOCAL}, json=request, verify=False) as resp:
resp.raise_for_status()
for chunk in resp.iter_lines():
print(json.loads(chunk))
**Output**:
{'result': {'headers': {'clientAppId': 'app1', 'transactionRef': ['txref-1'], 'requestTimeout': '2021-01-26T08:49:49.835818Z', [...]},
'payload': {'entities': [{'id': {'value': 'did:iotics:iotJsc2kDNWzF8Z73VbyTNp5M9jttEKAjY56'}, [...] }
{'error': {'grpc_code': 4, 'http_code': 504, 'http_status': 'GATEWAY_TIMEOUT',
'message': 'Request timeout reached, remaining responses available over STOMP subscription'}}