Build an Index

Build an Index

1import time
2from reasoner import Reasoner
3
4r = Reasoner(api_key=”foobar”)
5index = r.indexes.get("your-index-uid")
6index_uid = index["uid"]
7
8... # Add files and urls
9
10# Build the index with a blocking call
11updated_index = r.indexes.build(index_uid, wait=True)
12
13# Or start building the index (non-blocking call)
14updated_index = await r.indexes.build(index_uid)
15
16while True:
17 updated_index = r.indexes.get(index_uid)
18 if updated_index.status == 'success':
19 break
20
21 time.sleep(5)