MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / search_records

Function search_records

keepercommander/api.py:488–511  ·  view source on GitHub ↗

Search for string in record contents and return array of Record objects

(params, searchstring)

Source from the content-addressed store, hash-verified

486
487
488def search_records(params, searchstring):
489 """Search for string in record contents
490 and return array of Record objects """
491
492 p = re.compile(searchstring.lower())
493 search_results = []
494
495 for record_uid in params.record_cache:
496 rec = get_record(params, record_uid)
497 if not rec:
498 continue
499 cached_rec = params.record_cache[record_uid] or {}
500
501 if cached_rec.get('version') == 3:
502 data = cached_rec.get('data_unencrypted')
503 rec.record_type = RecordV3.get_record_type_name(data)
504 target = RecordV3.values_to_lowerstring(data)
505 else:
506 target = rec.to_lowerstring()
507
508 if p.search(target):
509 search_results.append(rec)
510
511 return search_results
512
513
514def search_shared_folders(params, searchstring, use_regex=False):

Callers

nothing calls this directly

Calls 6

getMethod · 0.80
get_record_type_nameMethod · 0.80
values_to_lowerstringMethod · 0.80
searchMethod · 0.80
get_recordFunction · 0.70
to_lowerstringMethod · 0.45

Tested by

no test coverage detected