""" Service MG/sources/calls/check to check whether the source exist. """ from tools.layer import Layer from tools import const def post(task, user=None, input_layer: Layer = None): """ Check whether the source exist Parameters ---------- user: str User ID input_layer : Layer Object Input Layer Returns ------- dict Dict with status and message Examples -------- >>> import requests >>> input_layer = {'user': 'user', ... 'password': '12345', ... 'ip': '192.168.1.3', ... 'protocol': 'FTP', ... 'type': 'VECTOR', ... 'driver_type': 'SHAPE', ... 'port': '2222', ... "domain": '', ... "source": '/SHP/VECTORES.shp', ... 'layer_name': 'VECTORES'} >>> parameters={'user':'TEST', "input_layer":input_layer} >>> response = requests.post(':/MG/sources/calls/check', ... json=parameters) >>> response.json() {'task_id': 'XoiRl9'} """ response = input_layer.check() if response: obj = {'status': 'ok', 'message': 'File or datasource suported'} else: obj = {'status': 'Error', 'message': 'File or datasource not suported'} return obj POST_REQUEST = { 'function': post, 'parser': const.PARSER_NONCLEAR }