semtk3.semtkclient module

class semtk3.semtkclient.SemTkClient(baseURL, service=None)

Bases: RestClient

JOB_ID_KEY = 'JobId'
RESULT_TYPE_KEY = 'resultType'
WARNINGS_KEY = 'warnings'
get_simple_field(simple_res, field)

get a simple field with REST error handling

get_simple_field_int(simple_res, field)

get integer simple results field returns int raises RestException on type or missing field

get_simple_field_str(simple_res, field)

get string from simple result returns string raises RestException on type or missing field

ping()

logger.INFO(success) or logger.ERROR(error) returns True (success) or False (failure)

post_to_jobid(endpoint, dataObj={})

returns string jobid raises errors otherwise

post_to_jobid_warnings(endpoint, dataObj={})

for ingestion jobs which return warnings at the initial call returns string jobid, [“warning1”, “warning2”] (where warnings can be None) raises errors otherwise

post_to_record_process(endpoint, dataObj={}, files=None)

returns records processed successfully raises RestException unless failuresEncountered = 0

post_to_simple(endpoint, dataObj={}, files=None)
returns dict - the simple results

which can be used as a regular dict, or with error-handling get_simple_field*() methods

post_to_status(endpoint, dataObj={}, files=None)

throws error if status is not success returns dict - the simple results,

which can be used as a regular dict, or with error-handling get_simple_field*() methods

post_to_table(endpoint, dataObj={})

returns dict - the table raises RestException