def getChemicalSpeciationData(request_dict): """ CTS web service endpoint for getting chemical speciation data through the chemspec model/class :param request - chemspec_model :return: chemical speciation data response json """ try: logging.info( "Incoming request for speciation data: {}".format(request_dict)) filtered_smiles = SMILESFilter().filterSMILES( request_dict.get('chemical')) logging.info("Speciation filtered SMILES: {}".format(filtered_smiles)) request_dict['chemical'] = filtered_smiles django_request = HttpResponse() django_request.POST = request_dict django_request.method = 'POST' chemspec_obj = chemspec_output.chemspecOutputPage(django_request) wrapped_post = { 'status': True, # 'metadata': '', 'data': chemspec_obj.run_data } json_data = json.dumps(wrapped_post) logging.info("chemspec model data: {}".format(chemspec_obj)) return HttpResponse(json_data, content_type='application/json') except Exception as error: logging.warning( "Error in cts_rest, getChemicalSpecation(): {}".format(error)) return HttpResponse("Error getting speciation data")
def createRequest(self, user: Staff, command: str = "") -> HttpResponse: rtr = HttpResponse() rtr.user = user rtr.POST = {"command": command} return rtr