def validate_service(current_item): """ Validate a single service :param current_item: Input item/service :return: Dictionary of results """ item_id = current_item[0] item_content = current_item[1] item = item_content['agolItem'] type_keywords = item['typeKeywords'] require_token = _requires_token("Requires Subscription", type_keywords) print(f"{item_id}\t{item_content['title']}") print(f"default retry count threshold: {item_content['default_retry_count']}") print(f"default timeout threshold: {item_content['default_timeout']}") print(f"service url: {item_content['service_url']}") print(f"requires token: {require_token}") response = RequestUtils.check_request(path=item_content["service_url"], params={}, try_json=True, add_token=require_token, retry_factor=item_content["default_retry_count"], timeout_factor=item_content["default_timeout"], token=item_content["token"], id=item_id) print("\n") return current_item[0], { **current_item[1], **{"serviceResponse": response} }
def check_layer_url(layer=None) -> dict: """ Check that the Item's url is valid """ if layer is None: layer = {} response = { "id": layer["id"], "success": False } if layer["success"]: url = layer["url"] response = RequestUtils.check_request(path=url, params=layer['params'], try_json=layer['try_json'], add_token=layer['add_token'], retry_factor=layer['retryCount'], timeout_factor=layer['timeout'], id=layer["id"], token=layer['token']) return response
def check_alfp_url(input_data=None) -> dict: """ :param input_data: :return: """ if input_data is None: input_data = {} response = RequestUtils.check_request(path=input_data["url"], params=input_data['params'], try_json=input_data['try_json'], add_token=input_data['add_token'], retry_factor=input_data['retry_factor'], timeout_factor=input_data['timeout_factor'], token=input_data['token'], id=input_data["id"]) return { "id": input_data["id"], "response": response }