Skip to content

Commit 1de846c

Browse files
committed
adding an option to hand over the osw_obj to get_entities_from_osw()
1 parent 7ea127b commit 1de846c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/osw/data/import_utility.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ def get_entities_from_osw(
680680
model_to_cast_to,
681681
credentials_fp,
682682
domain,
683+
osw_obj: OSW = None,
683684
debug: bool = False,
684685
) -> list:
685686
"""Gets entities from OSW, based on a category. The category can be specified by
@@ -706,8 +707,9 @@ def get_entities_from_osw(
706707
category_uuid = category_to_search.split("OSW")[-1]
707708
else: # elif isinstance(category_to_search, uuid_module.UUID):
708709
category_uuid = str(category_to_search)
709-
cred_man = CredentialManager(cred_filepath=credentials_fp)
710-
osw_obj = OSW(site=WtSite(WtSite.WtSiteConfig(iri=domain, cred_mngr=cred_man)))
710+
if osw_obj is None:
711+
cred_man = CredentialManager(cred_filepath=credentials_fp)
712+
osw_obj = OSW(site=WtSite(WtSite.WtSiteConfig(iri=domain, cred_mngr=cred_man)))
711713
wtsite_obj = osw_obj.site
712714
entities_from_osw = []
713715
if debug:

0 commit comments

Comments
 (0)