How to use logException method in fMBT

Best Python code snippet using fMBT_python

logclient.py

Source:logclient.py Github

copy

Full Screen

1#!/usr/bin/env python2# encoding: utf-834# Copyright (C) Alibaba Cloud Computing5# All rights reserved.67import sys8import requests9try:10 import json11except ImportError:12 import simplejson as json1314try : 15 import logservice_lz416except ImportError:17 pass1819from datetime import datetime20from log_logs_pb2 import LogGroup21from aliyun.log.util import Util22from aliyun.log.logexception import LogException23from aliyun.log.getlogsresponse import GetLogsResponse24from aliyun.log.putlogsresponse import PutLogsResponse25from aliyun.log.listtopicsresponse import ListTopicsResponse26from aliyun.log.listlogstoresresponse import ListLogstoresResponse27from aliyun.log.gethistogramsresponse import GetHistogramsResponse2829from aliyun.log.logstore_config_response import CreateLogStoreResponse30from aliyun.log.logstore_config_response import DeleteLogStoreResponse31from aliyun.log.logstore_config_response import GetLogStoreResponse32from aliyun.log.logstore_config_response import UpdateLogStoreResponse33from aliyun.log.logstore_config_response import ListLogStoreResponse3435from aliyun.log.pulllog_response import PullLogResponse36from aliyun.log.cursor_response import GetCursorResponse37from aliyun.log.cursor_time_response import GetCursorTimeResponse3839from aliyun.log.index_config_response import CreateIndexResponse40from aliyun.log.index_config_response import UpdateIndexResponse41from aliyun.log.index_config_response import DeleteIndexResponse42from aliyun.log.index_config_response import GetIndexResponse4344from aliyun.log.logtail_config_response import CreateLogtailConfigResponse45from aliyun.log.logtail_config_response import UpdateLogtailConfigResponse46from aliyun.log.logtail_config_response import DeleteLogtailConfigResponse47from aliyun.log.logtail_config_response import GetLogtailConfigResponse48from aliyun.log.logtail_config_response import ListLogtailConfigResponse4950from aliyun.log.machinegroup_response import CreateMachineGroupResponse51from aliyun.log.machinegroup_response import UpdateMachineGroupResponse52from aliyun.log.machinegroup_response import DeleteMachineGroupResponse53from aliyun.log.machinegroup_response import GetMachineGroupResponse54from aliyun.log.machinegroup_response import ListMachineGroupResponse5556from aliyun.log.machinegroup_response import ListMachinesResponse57from aliyun.log.machinegroup_response import ApplyConfigToMachineGroupResponse58from aliyun.log.machinegroup_response import RemoveConfigToMachineGroupResponse59from aliyun.log.machinegroup_response import GetMachineGroupAppliedConfigResponse60from aliyun.log.machinegroup_response import GetConfigAppliedMachineGroupsResponse61from aliyun.log.acl_response import UpdateAclResponse62from aliyun.log.acl_response import ListAclResponse6364from aliyun.log.shard_response import ListShardResponse65from aliyun.log.shard_response import DeleteShardResponse6667from aliyun.log.shipper_response import CreateShipperResponse68from aliyun.log.shipper_response import UpdateShipperResponse69from aliyun.log.shipper_response import DeleteShipperResponse70from aliyun.log.shipper_response import GetShipperConfigResponse71from aliyun.log.shipper_response import ListShipperResponse72from aliyun.log.shipper_response import GetShipperTasksResponse73from aliyun.log.shipper_response import RetryShipperTasksResponse7475from aliyun.log.project_response import CreateProjectResponse76from aliyun.log.project_response import DeleteProjectResponse77from aliyun.log.project_response import GetProjectResponse7879CONNECTION_TIME_OUT = 2080API_VERSION = '0.6.0'81USER_AGENT = 'log-python-sdk-v-0.6.1'8283"""84LogClient class is the main class in the SDK. It can be used to communicate with 85log service server to put/get data.8687:Author: log_dev88"""8990class LogClient(object):91 """ Construct the LogClient with endpoint, accessKeyId, accessKey.92 93 :type endpoint: string94 :param endpoint: log service host name, for example, http://ch-hangzhou.sls.aliyuncs.com95 96 :type accessKeyId: string97 :param accessKeyId: aliyun accessKeyId98 99 :type accessKey: string100 :param accessKey: aliyun accessKey101 """102 103 __version__ = API_VERSION104 Version = __version__105 106 def __init__(self, endpoint, accessKeyId, accessKey,securityToken = None):107 if isinstance(endpoint, unicode): # ensure is ascii str108 endpoint = endpoint.encode('ascii')109 if isinstance(accessKeyId, unicode):110 accessKeyId = accessKeyId.encode('ascii')111 if isinstance(accessKey, unicode):112 accessKey = accessKey.encode('ascii')113 self._isRowIp = True114 self._port = 80115 self._setendpoint(endpoint)116 self._accessKeyId = accessKeyId117 self._accessKey = accessKey118 self._timeout = CONNECTION_TIME_OUT119 self._source = Util.get_host_ip(self._logHost)120 self._securityToken = securityToken;121122 def _setendpoint(self, endpoint):123 pos = endpoint.find('://')124 if pos != -1:125 endpoint = endpoint[pos + 3:] # strip http://126 pos = endpoint.find('/')127 if pos != -1:128 endpoint = endpoint[:pos]129 pos = endpoint.find(':')130 if pos != -1:131 self._port = int(endpoint[pos + 1:])132 endpoint = endpoint[:pos]133 self._isRowIp = Util.is_row_ip(endpoint)134 self._logHost = endpoint135 self._endpoint = endpoint + ':' + str(self._port)136137 def _getGMT(self):138 return datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')139140 def _loadJson(self, respText, requestId):141 if not respText:142 return None143 try:144 return json.loads(respText)145 except:146 raise LogException('BadResponse', 147 'Bad json format:\n%s' % respText,148 requestId)149 150 def _getHttpResponse(self, method, url, params, body, headers): # ensure method, url, body is str151 try : 152 headers['User-Agent'] = USER_AGENT153 r = None154 if method.lower() == 'get' : 155 r = requests.get(url, params = params, data = body, headers = headers, timeout = self._timeout)156 elif method.lower() == 'post': 157 r = requests.post(url, params = params, data = body, headers = headers, timeout = self._timeout)158 elif method.lower() == 'put': 159 r = requests.put(url, params = params, data = body, headers = headers, timeout = self._timeout)160 elif method.lower() == 'delete': 161 r = requests.delete(url, params = params, data = body, headers = headers, timeout = self._timeout)162 return (r.status_code, r.content, r.headers) 163 except Exception, ex:164 raise LogException('LogRequestError', str(ex))165 166 def _sendRequest(self, method, url, params, body, headers, respons_body_type = 'json'):167 (status, respText, respHeader) = self._getHttpResponse(method, url, params, body, headers)168 header = {}169 for key, value in respHeader.items():170 header[key] = value171 172 requestId = header['x-log-requestid'] if 'x-log-requestid' in header else ''173 exJson = None174175 header = Util.convert_unicode_to_str(header)176 if status == 200 : 177 if respons_body_type == 'json' : 178 exJson = self._loadJson(respText, requestId)179 #exJson = Util.convert_unicode_to_str(exJson)180 return (exJson, header)181 else : 182 return (respText, header)183 184 exJson = self._loadJson(respText.encode('utf-8'), requestId)185 exJson = Util.convert_unicode_to_str(exJson)186187 if 'errorCode' in exJson and 'errorMessage' in exJson:188 raise LogException(exJson['errorCode'], exJson['errorMessage'], requestId)189 else:190 exJson = '. Return json is '+str(exJson) if exJson else '.'191 raise LogException('LogRequestError', 192 'Request is failed. Http code is '+str(status)+exJson, requestId)193 194 def _send(self, method, project, body, resource, params, headers, respons_body_type ='json'):195 if body:196 headers['Content-Length'] = str(len(body))197 headers['Content-MD5'] = Util.cal_md5(body)198 else:199 headers['Content-Length'] = '0'200 headers["x-log-bodyrawsize"] = '0'201 202 headers['x-log-apiversion'] = API_VERSION203 headers['x-log-signaturemethod'] = 'hmac-sha1'204 url = ''205 if self._isRowIp:206 url = "http://" + self._endpoint207 else:208 url = "http://" + project + "." + self._endpoint209 headers['Host'] = project + "." + self._logHost210 headers['Date'] = self._getGMT()211 if self._securityToken != None and self._securityToken != "" :212 headers["x-acs-security-token"] = self._securityToken213 214 signature = Util.get_request_authorization(method, resource,215 self._accessKey, params, headers)216 headers['Authorization'] = "LOG " + self._accessKeyId + ':' + signature217 url = url + resource218 return self._sendRequest(method, url, params, body, headers, respons_body_type)219 220 def get_unicode(self, key):221 if isinstance(key, str):222 key = unicode(key, 'utf-8')223 return key224 225 226 def put_logs(self, request):227 """ Put logs to log service.228 Unsuccessful opertaion will cause an LogException.229 230 :type request: PutLogsRequest231 :param request: the PutLogs request parameters class232 233 :return: PutLogsResponse234 235 :raise: LogException236 """237 if len(request.get_log_items()) > 4096:238 raise LogException('InvalidLogSize', 239 "logItems' length exceeds maximum limitation: 4096 lines.")240 logGroup = LogGroup()241 logGroup.Topic = request.get_topic()242 if request.get_source():243 logGroup.Source = request.get_source()244 else:245 if self._source=='127.0.0.1':246 self._source = Util.get_host_ip(request.get_project() + '.' + self._logHost)247 logGroup.Source = self._source248 for logItem in request.get_log_items():249 log = logGroup.Logs.add()250 log.Time = logItem.get_time()251 contents = logItem.get_contents()252 for key, value in contents:253 content = log.Contents.add()254 content.Key = self.get_unicode(key)255 content.Value = self.get_unicode(value)256 body = logGroup.SerializeToString()257 if len(body) > 3 * 1024 * 1024: # 3 MB258 raise LogException('InvalidLogSize', 259 "logItems' size exceeds maximum limitation: 3 MB.")260 261 headers = {}262 headers['x-log-bodyrawsize'] = str(len(body))263 headers['Content-Type'] = 'application/x-protobuf'264 is_compress = request.get_compress()265266 compress_data = None267 if is_compress : 268 headers['x-log-compresstype'] = 'lz4'269 compress_data = logservice_lz4.compress(body) 270271 params = {}272 logstore = request.get_logstore()273 project = request.get_project()274 resource = '/logstores/' + logstore275 if request.get_hash_key() is not None:276 resource = '/logstores/' + logstore+"/shards/route"277 params["key"] = request.get_hash_key() 278 else:279 resource = '/logstores/' + logstore+"/shards/lb"280281 respHeaders = None282 if is_compress : 283 respHeaders = self._send('POST', project, compress_data, resource, params, headers)284 else : 285 respHeaders = self._send('POST', project, body, resource, params, headers)286287 return PutLogsResponse(respHeaders[1])288 289 def list_logstores(self, request):290 """ List all logstores of requested project.291 Unsuccessful opertaion will cause an LogException.292 293 :type request: ListLogstoresRequest294 :param request: the ListLogstores request parameters class.295 296 :return: ListLogStoresResponse297 298 :raise: LogException299 """300 headers = {}301 params = {}302 resource = '/logstores'303 project = request.get_project()304 (resp, header) = self._send("GET", project, None, resource, params, headers)305 return ListLogstoresResponse(resp, header)306 307 def list_topics(self, request):308 """ List all topics in a logstore.309 Unsuccessful opertaion will cause an LogException.310 311 :type request: ListTopicsRequest312 :param request: the ListTopics request parameters class.313 314 :return: ListTopicsResponse315 316 :raise: LogException317 """318 headers = {}319 params = {}320 if request.get_token()!=None:321 params['token'] = request.get_token()322 if request.get_line()!=None:323 params['line'] = request.get_line()324 params['type'] = 'topic'325 logstore = request.get_logstore()326 project = request.get_project()327 resource = "/logstores/" + logstore328 (resp, header) = self._send("GET", project, None, resource, params, headers)329 return ListTopicsResponse(resp, header)330331 def get_histograms(self, request):332 """ Get histograms of requested query from log service.333 Unsuccessful opertaion will cause an LogException.334 335 :type request: GetHistogramsRequest336 :param request: the GetHistograms request parameters class.337 338 :return: GetHistogramsResponse339 340 :raise: LogException341 """342 headers = {}343 params = {}344 if request.get_topic()!=None:345 params['topic'] = request.get_topic()346 if request.get_from()!=None:347 params['from'] = request.get_from()348 if request.get_to()!=None:349 params['to'] = request.get_to()350 if request.get_query()!=None:351 params['query'] = request.get_query()352 params['type'] = 'histogram'353 logstore = request.get_logstore()354 project = request.get_project()355 resource = "/logstores/" + logstore356 (resp, header) = self._send("GET", project, None, resource, params, headers)357 return GetHistogramsResponse(resp, header)358359 def get_logs(self, request):360 """ Get logs from log service.361 Unsuccessful opertaion will cause an LogException.362 363 :type request: GetLogsRequest364 :param request: the GetLogs request parameters class.365 366 :return: GetLogsResponse367 368 :raise: LogException369 """370 headers = {}371 params = {}372 if request.get_topic()!=None:373 params['topic'] = request.get_topic()374 if request.get_from()!=None:375 params['from'] = request.get_from()376 if request.get_to()!=None:377 params['to'] = request.get_to()378 if request.get_query()!=None:379 params['query'] = request.get_query()380 params['type'] = 'log'381 if request.get_line()!=None:382 params['line'] = request.get_line()383 if request.get_offset()!=None:384 params['offset'] = request.get_offset()385 if request.get_reverse()!=None:386 params['reverse'] = 'true' if request.get_reverse() else 'false'387 logstore = request.get_logstore()388 project = request.get_project()389 resource = "/logstores/" + logstore390 (resp, header) = self._send("GET", project, None, resource, params, headers)391 return GetLogsResponse(resp, header)392 393394 def get_cursor(self, project_name, logstore_name, shard_id, start_time) : 395 """ Get cursor from log service for batch pull logs396 Unsuccessful opertaion will cause an LogException.397 :type project_name: string398 :param project_name: the Project name 399400 :type logstore_name: string401 :param logstore_name: the logstore name402403 :type shard_id: int404 :param shard_id: the shard id405406 :type start_time: int407 :param start_time: the start time of cursor, e.g 1441093445408409 :return: GetCursorResponse410 411 :raise: LogException412 """413414 headers = {}415 headers['Content-Type'] = 'application/json'416 params = {}417 resource = "/logstores/" + logstore_name + "/shards/" + str(shard_id)418 params['type'] = 'cursor'419 params['from'] = str(start_time)420 421 (resp, header) = self._send("GET", project_name, None, resource, params, headers)422 return GetCursorResponse(resp, header)423424425 def get_cursor_time(self, project_name, logstore_name, shard_id, cursor) : 426 """ Get cursor time from log service427 Unsuccessful opertaion will cause an LogException.428 :type project_name: string429 :param project_name: the Project name 430431 :type logstore_name: string432 :param logstore_name: the logstore name433434 :type shard_id: int435 :param shard_id: the shard id436437 :type cursor: string438 :param cursor: the cursor to get its service receive time439440 :return: GetCursorTimeResponse441 442 :raise: LogException443 """444445 headers = {}446 headers['Content-Type'] = 'application/json'447 params = {}448 resource = "/logstores/" + logstore_name + "/shards/" + str(shard_id)449 params['type'] = 'cursor_time'450 params['cursor'] = cursor451 452 (resp, header) = self._send("GET", project_name, None, resource, params, headers)453 return GetCursorTimeResponse(resp, header)454455 def get_begin_cursor(self, project_name, logstore_name, shard_id) :456 """ Get begin cursor from log service for batch pull logs457 Unsuccessful opertaion will cause an LogException.458 :type project_name: string459 :param project_name: the Project name 460461 :type logstore_name: string462 :param logstore_name: the logstore name463464 :type shard_id: int465 :param shard_id: the shard id466467 :return: GetLogsResponse468 469 :raise: LogException470 """471 return self.get_cursor(project_name, logstore_name, shard_id, "begin")472473 def get_end_cursor(self, project_name, logstore_name, shard_id) : 474 """ Get end cursor from log service for batch pull logs475 Unsuccessful opertaion will cause an LogException.476 :type project_name: string477 :param project_name: the Project name 478479 :type logstore_name: string480 :param logstore_name: the logstore name481482 :type shard_id: int483 :param shard_id: the shard id484485 :return: GetLogsResponse486 487 :raise: LogException488 """489 return self.get_cursor(project_name, logstore_name, shard_id, "end")490491 def pull_logs(self, project_name, logstore_name, shard_id, cursor, count = 1000, end_cursor = None, compress=False):492 """ batch pull log data from log service493 Unsuccessful opertaion will cause an LogException.494 :type project_name: string495 :param project_name: the Project name 496497 :type logstore_name: string498 :param logstore_name: the logstore name499500 :type shard_id: int501 :param shard_id: the shard id502503 :type cursor: string504 :param cursor: the start to cursor to get data505506 :type count: int507 :param count: the required pull log package count, default 1000 packages508509 :type end_cursor : string510 :param end_cursor: the end cursor position to get data511512 :type comress : boolean513 :param compress : if use lz4 compress for transfer data514515 :return: PullLogResponse516 517 :raise: LogException518 """519 headers = {}520 if compress :521 headers['Accept-Encoding'] = 'lz4'522 else : 523 headers['Accept-Encoding'] = ''524525 headers['Accept'] = 'application/x-protobuf'526 527 params = {}528 resource = "/logstores/" + logstore_name + "/shards/" + str(shard_id)529 params['type'] = 'log'530 params['cursor'] = cursor531 params['count'] = str(count)532 if end_cursor != None and len(end_cursor) > 0 :533 params['end_cursor'] = end_cursor534 (resp, header) = self._send("GET", project_name, None, resource, params, headers, "binary")535 if compress : 536 raw_size = int(header['x-log-bodyrawsize'])537 raw_data = logservice_lz4.uncompress(raw_size, resp)538 return PullLogResponse(raw_data, header)539 else : 540 return PullLogResponse(resp, header)541 542543544 def create_logstore(self, project_name, logstore_name, ttl, shard_count):545 """ create log store 546 Unsuccessful opertaion will cause an LogException.547 :type project_name: string548 :param project_name: the Project name 549550 :type logstore_name: string551 :param logstore_name: the logstore name552553 :type ttl: int554 :param ttl: the life cycle of log in the logstore in days555556 :type shard_count: int557 :param shard_count: the shard count of the logstore to create558559560 :return: CreateLogStoreResponse561 562 :raise: LogException563 """564 headers = {}565 params = {}566 headers["x-log-bodyrawsize"] = '0'567 headers["Content-Type"] = "application/json"568 resource = "/logstores"569 body = {}570 body["logstoreName"] = logstore_name.encode("utf-8");571 body["ttl"] = (int)(ttl);572 body["shardCount"] = (int)(shard_count);573 body_str = json.dumps(body);574 (resp, header) = self._send("POST", project_name, body_str, resource, params, headers)575 return CreateLogStoreResponse(header)576577578 def delete_logstore(self, project_name, logstore_name):579 """ delete log store580 Unsuccessful opertaion will cause an LogException.581582 :type project_name: string583 :param project_name: the Project name 584585 :type logstore_name: string586 :param logstore_name: the logstore name587588 :return: DeleteLogStoreResponse589 590 :raise: LogException591 """592 headers = {}593 params = {}594 resource = "/logstores/" + logstore_name595 (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)596 return DeleteLogStoreResponse(header)597598 def get_logstore(self, project_name, logstore_name):599 """ get the logstore meta info600 Unsuccessful opertaion will cause an LogException.601602 :type project_name: string603 :param project_name: the Project name 604605 :type logstore_name: string606 :param logstore_name: the logstore name607608 :return: GetLogStoreResponse609 610 :raise: LogException611 """612613 headers = {}614 params = {}615 resource = "/logstores/" + logstore_name616 (resp, header) = self._send("GET", project_name, None, resource, params, headers)617 return GetLogStoreResponse(resp, header)618619 def update_logstore(self, project_name, logstore_name, ttl, shard_count):620 """ 621 update the logstore meta info622 Unsuccessful opertaion will cause an LogException.623624 :type project_name: string625 :param project_name: the Project name 626627 :type logstore_name: string628 :param logstore_name: the logstore name629630 :type ttl: int631 :param ttl: the life cycle of log in the logstore in days632633 :type shard_count: int634 :param shard_count: the shard count of the logstore to create635636 :return: UpdateLogStoreResponse637 638 :raise: LogException639 """640641 headers = {}642 headers["x-log-bodyrawsize"] = '0'643 headers["Content-Type"] = "application/json"644 params = {}645 resource = "/logstores/" + logstore_name646 body = {}647 body["logstoreName"] = logstore_name648 body["ttl"] = (int)(ttl);649 body["shardCount"] = (int)(shard_count);650 body_str = json.dumps(body);651 (resp, header) = self._send("PUT", project_name, body_str, resource, params, headers)652 return UpdateLogStoreResponse(header)653654655 def list_logstore(self, project_name, logstore_name_pattern = None, offset = 0, size = 100) :656 """ list the logstore in a project657 Unsuccessful opertaion will cause an LogException.658659 :type project_name: string660 :param project_name: the Project name 661662 :type logstore_name_pattern: string663 :param logstore_name_pattern: the sub name logstore, used for the server to return logstore names contain this sub name664665 :type offset: int666 :param offset: the offset of all the matched names667668 :type size: int669 :param size: the max return names count670671 :return: ListLogStoreResponse672 673 :raise: LogException674 """675 headers = {}676 params = {}677 resource = "/logstores"678 if logstore_name_pattern != None :679 params['logstorename'] = logstore_name_pattern680 params['offset'] = str(offset)681 params['size'] = str(size)682 (resp, header) = self._send("GET", project_name, None, resource, params, headers)683 return ListLogStoreResponse(resp, header)684685686 def list_shards(self, project_name, logstore_name) :687 """ list the shard meta of a logstore688 Unsuccessful opertaion will cause an LogException.689690 :type project_name: string691 :param project_name: the Project name 692693 :type logstore_name: string694 :param logstore_name: the logstore name695696 :return: ListShardResponse697 698 :raise: LogException699 """700 headers = {}701 params = {}702 resource = "/logstores/" + logstore_name + "/shards"703 (resp, header) = self._send("GET", project_name, None, resource, params, headers)704 return ListShardResponse(resp, header)705 def split_shard(self,project_name,logstore_name,shardId,split_hash):706 """ split a readwrite shard into two shards707 Unsuccessful opertaion will cause an LogException.708709 :type project_name: string710 :param project_name: the Project name 711712 :type logstore_name: string713 :param logstore_name: the logstore name714 715 :type shardId: int716 :param shardId : the shard id717718 :type split_hash: string719 :param split_hash: the internal hash between the shard begin and end hash720721 :return: ListShardResponse722 723 :raise: LogException724 """725726 headers = {}727 params = {"action":"split","key":split_hash}728 resource = "/logstores/"+logstore_name+"/shards/"+str(shardId);729 (resp,header) = self._send("POST",project_name,None,resource,params,headers);730 return ListShardResponse(resp,header);731732 def merge_shard(self,project_name,logstore_name,shardId):733 """ split two adjacent readwrite hards into one shards734 Unsuccessful opertaion will cause an LogException.735736 :type project_name: string737 :param project_name: the Project name 738739 :type logstore_name: string740 :param logstore_name: the logstore name741 742 :type shardId: int743 :param shardId : the shard id of the left shard, server will determine the right adjacent shardId744745 :return: ListShardResponse746 747 :raise: LogException748 """749 headers = {}750 params = {"action":"merge"}751 resource = "/logstores/"+logstore_name+"/shards/"+str(shardId);752 (resp,header) = self._send("POST",project_name,None,resource,params,headers);753 return ListShardResponse(resp,header);754755 def delete_shard(self,project_name,logstore_name,shardId):756 """ delete a readonly shard 757 Unsuccessful opertaion will cause an LogException.758759 :type project_name: string760 :param project_name: the Project name 761762 :type logstore_name: string763 :param logstore_name: the logstore name764 765 :type shardId: int766 :param shardId : the read only shard id 767768 :return: ListShardResponse769 770 :raise: LogException771 """772 headers = {}773 params = {}774 resource = "/logstores/"+logstore_name+"/shards/"+str(shardId);775 (resp,header) = self._send("DELETE",project_name,None,resource,params,headers);776 return DeleteShardResponse(header);777778779780 def create_index(self, project_name, logstore_name, index_detail) : 781 """ create index for a logstore782 Unsuccessful opertaion will cause an LogException.783784 :type project_name: string785 :param project_name: the Project name 786787 :type logstore_name: string788 :param logstore_name: the logstore name789790 :type index_detail: index_config.IndexConfig791 :param index_detail: the index config detail used to create index792793 :return: CreateIndexResponse794 795 :raise: LogException796 """797 headers = {}798 params = {}799 resource = "/logstores/" + logstore_name + "/index"800 headers['Content-Type'] = 'application/json'801 body = json.dumps(index_detail.to_json())802 headers['x-log-bodyrawsize'] = str(len(body))803804 (resp, header) = self._send("POST", project_name, body, resource, params, headers)805 return CreateIndexResponse(header)806807 def update_index(self, project_name, logstore_name, index_detail) : 808 """ update index for a logstore809 Unsuccessful opertaion will cause an LogException.810811 :type project_name: string812 :param project_name: the Project name 813814 :type logstore_name: string815 :param logstore_name: the logstore name816817 :type index_detail: index_config.IndexConfig818 :param index_detail: the index config detail used to update index819820 :return: UpdateIndexResponse821 822 :raise: LogException823 """824825 headers = {}826 params = {}827 resource = "/logstores/" + logstore_name + "/index"828 headers['Content-Type'] = 'application/json'829 body = json.dumps(index_detail.to_json())830 headers['x-log-bodyrawsize'] = str(len(body))831832 (resp, header) = self._send("PUT", project_name, body, resource, params, headers)833 return UpdateIndexResponse(header)834 835 def delete_index(self, project_name, logstore_name) :836 """ delete index of a logstore837 Unsuccessful opertaion will cause an LogException.838839 :type project_name: string840 :param project_name: the Project name 841842 :type logstore_name: string843 :param logstore_name: the logstore name844845 :return: DeleteIndexResponse846 847 :raise: LogException848 """849850 headers = {}851 params = {}852 resource = "/logstores/" + logstore_name + "/index"853 (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)854 return DeleteIndexResponse(header)855856 def get_index_config(self, project_name , logstore_name) :857 """ get index config detail of a logstore858 Unsuccessful opertaion will cause an LogException.859860 :type project_name: string861 :param project_name: the Project name 862863 :type logstore_name: string864 :param logstore_name: the logstore name865866 :return: GetIndexResponse867 868 :raise: LogException869 """870871 headers = {}872 params = {}873 resource = "/logstores/" + logstore_name + "/index"874 (resp, header) = self._send("GET", project_name, None, resource, params, headers)875 return GetIndexResponse(resp, header)876877878 def create_logtail_config(self, project_name, config_detail) : 879 """ create logtail config in a project880 Unsuccessful opertaion will cause an LogException.881882 :type project_name: string883 :param project_name: the Project name 884885 :type config_detail: logtail_config_detail.CommonRegLogConfigDetail or logtail_config_detail.ApsaraLogConfigDetail886 :param config_detail: the logtail config detail info, the CommonRegLogConfigDetail is used to create common regex logs ,the ApsaraLogConfigDetail is used to create apsara log887888 :return: CreateLogtailConfigResponse889 890 :raise: LogException891 """892893 headers = {}894 params = {}895 resource = "/configs"896 headers['Content-Type'] = 'application/json'897 body = json.dumps(config_detail.to_json())898 headers['x-log-bodyrawsize'] = str(len(body))899 (resp, headers) = self._send("POST", project_name, body, resource, params, headers)900 return CreateLogtailConfigResponse(headers)901902 def update_logtail_config(self, project_name, config_detail) : 903 """ update logtail config in a project904 Unsuccessful opertaion will cause an LogException.905906 :type project_name: string907 :param project_name: the Project name 908909 :type config_detail: logtail_config_detail.CommonRegLogConfigDetail or logtail_config_detail.ApsaraLogConfigDetail910 :param config_detail: the logtail config detail info, the CommonRegLogConfigDetail is used to create common regex logs, the ApsaraLogConfigDetail is used to create apsara log911912 :return: UpdateLogtailConfigResponse913 914 :raise: LogException915 """916917 headers = {}918 params = {}919 resource = "/configs/" + config_detail.config_name920 headers['Content-Type'] = 'application/json'921 body = json.dumps(config_detail.to_json())922 headers['x-log-bodyrawsize'] = str(len(body))923 (resp, headers) = self._send("PUT", project_name, body, resource, params, headers)924 return UpdateLogtailConfigResponse(headers)925926927 def delete_logtail_config(self, project_name, config_name):928 """ delete logtail config in a project929 Unsuccessful opertaion will cause an LogException.930931 :type project_name: string932 :param project_name: the Project name 933934 :type config_name: string935 :param config_name: the logtail config name936937 :return: DeleteLogtailConfigResponse938 939 :raise: LogException940 """941942 headers = {}943 params = {}944 resource = "/configs/" + config_name945 (resp, headers) = self._send("DELETE", project_name, None, resource, params, headers)946 return DeleteLogtailConfigResponse(headers)947948949 def get_logtail_config(self, project_name, config_name) : 950 """ get logtail config in a project951 Unsuccessful opertaion will cause an LogException.952953 :type project_name: string954 :param project_name: the Project name 955956 :type config_name: string957 :param config_name: the logtail config name958959 :return: GetLogtailConfigResponse960 961 :raise: LogException962 """963 headers = {}964 params = {}965 resource = "/configs/" + config_name966 (resp, headers) = self._send("GET", project_name, None, resource, params, headers)967 return GetLogtailConfigResponse(resp, headers)968969970 def list_logtail_config(self, project_name, offset = 0, size = 100) :971 """ list logtail config name in a project972 Unsuccessful opertaion will cause an LogException.973974 :type project_name: string975 :param project_name: the Project name 976977 :type offset: int978 :param offset: the offset of all config names979980 :type size: int981 :param size: the max return names count982983 :return: ListLogtailConfigResponse984 985 :raise: LogException986 """987 headers = {}988 params = {}989 resource = "/configs"990 params['offset'] = str(offset)991 params['size'] = str(size)992 (resp, header) = self._send("GET", project_name, None, resource, params, headers)993 return ListLogtailConfigResponse(resp, header)994995996 def create_machine_group(self, project_name, group_detail) : 997 """ create machine group in a project998 Unsuccessful opertaion will cause an LogException.9991000 :type project_name: string1001 :param project_name: the Project name 10021003 :type group_detail: machine_group_detail.MachineGroupDetail1004 :param group_detail: the machine group detail config10051006 :return: CreateMachineGroupResponse1007 1008 :raise: LogException1009 """10101011 headers = {}1012 params = {}1013 resource = "/machinegroups"1014 headers['Content-Type'] = 'application/json'1015 body = json.dumps(group_detail.to_json())1016 headers['x-log-bodyrawsize'] = str(len(body))1017 (resp, headers) = self._send("POST", project_name, body, resource, params, headers)1018 return CreateMachineGroupResponse(headers)10191020 def delete_machine_group(self, project_name, group_name):1021 """ delete machine group in a project1022 Unsuccessful opertaion will cause an LogException.10231024 :type project_name: string1025 :param project_name: the Project name 10261027 :type group_name: string1028 :param group_name: the group name10291030 :return: DeleteMachineGroupResponse1031 1032 :raise: LogException1033 """10341035 headers = {}1036 params = {}1037 resource = "/machinegroups/" + group_name1038 (resp, headers) = self._send("DELETE", project_name, None, resource, params, headers)1039 return DeleteMachineGroupResponse(headers)10401041 def update_machine_group(self, project_name, group_detail) : 1042 """ update machine group in a project1043 Unsuccessful opertaion will cause an LogException.10441045 :type project_name: string1046 :param project_name: the Project name 10471048 :type group_detail: machine_group_detail.MachineGroupDetail1049 :param group_detail: the machine group detail config10501051 :return: UpdateMachineGroupResponse1052 1053 :raise: LogException1054 """10551056 headers = {}1057 params = {}1058 resource = "/machinegroups/" + group_detail.group_name1059 headers['Content-Type'] = 'application/json'1060 body = json.dumps(group_detail.to_json())1061 headers['x-log-bodyrawsize'] = str(len(body))1062 (resp, headers) = self._send("PUT", project_name, body, resource, params, headers)1063 return UpdateMachineGroupResponse(headers)10641065 def get_machine_group(self, project_name, group_name) : 1066 """ get machine group in a project1067 Unsuccessful opertaion will cause an LogException.10681069 :type project_name: string1070 :param project_name: the Project name 10711072 :type group_name: string1073 :param group_name: the group name to get10741075 :return: GetMachineGroupResponse1076 1077 :raise: LogException1078 """10791080 headers = {}1081 params = {}1082 resource = "/machinegroups/" + group_name1083 (resp, headers) = self._send("GET", project_name, None, resource, params, headers)1084 return GetMachineGroupResponse(resp, headers)10851086 def list_machine_group(self, project_name, offset = 0, size = 100) :1087 """ list machine group names in a project1088 Unsuccessful opertaion will cause an LogException.10891090 :type project_name: string1091 :param project_name: the Project name 10921093 :type offset: int1094 :param offset: the offset of all group name10951096 :type size: int1097 :param size: the max return names count10981099 :return: ListMachineGroupResponse1100 1101 :raise: LogException1102 """11031104 headers = {}1105 params = {}1106 resource = "/machinegroups"1107 params['offset'] = str(offset)1108 params['size'] = str(size)1109 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1110 return ListMachineGroupResponse(resp, header)11111112 def list_machines(self, project_name, group_name, offset = 0, size = 100) : 1113 """ list machines in a machine group1114 Unsuccessful opertaion will cause an LogException.11151116 :type project_name: string1117 :param project_name: the Project name 1118 1119 :type group_name: string1120 :param group_name: the group name to list11211122 :type offset: int1123 :param offset: the offset of all group name11241125 :type size: int1126 :param size: the max return names count11271128 :return: ListMachinesResponse1129 1130 :raise: LogException1131 """11321133 headers = {}1134 params = {}1135 resource = "/machinegroups/" + group_name + "/machines"1136 params['offset'] = str(offset)1137 params['size'] = str(size)1138 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1139 return ListMachinesResponse(resp, header)11401141 def apply_config_to_machine_group(self, project_name, config_name, group_name) : 1142 """ apply a logtail config to a machine group1143 Unsuccessful opertaion will cause an LogException.11441145 :type project_name: string1146 :param project_name: the Project name 11471148 :type config_name: string1149 :param config_name: the logtail config name to apply1150 1151 :type group_name: string1152 :param group_name: the machine group name 11531154 :return: ApplyConfigToMachineGroupResponse1155 1156 :raise: LogException1157 """1158 headers = {}1159 params = {}1160 resource = "/machinegroups/" + group_name + "/configs/" + config_name1161 (resp, header) = self._send("PUT", project_name, None, resource, params, headers)1162 return ApplyConfigToMachineGroupResponse(header)11631164 def remove_config_to_machine_group(self, project_name, config_name, group_name) : 1165 """ remove a logtail config to a machine group1166 Unsuccessful opertaion will cause an LogException.11671168 :type project_name: string1169 :param project_name: the Project name 11701171 :type config_name: string1172 :param config_name: the logtail config name to apply1173 1174 :type group_name: string1175 :param group_name: the machine group name 11761177 :return: RemoveConfigToMachineGroupResponse1178 1179 :raise: LogException1180 """1181 headers = {}1182 params = {}1183 resource = "/machinegroups/" + group_name + "/configs/" + config_name1184 (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)1185 return RemoveConfigToMachineGroupResponse(header)118611871188 def get_machine_group_applied_configs(self, project_name, group_name):1189 """ get the logtail config names applied in a machine group1190 Unsuccessful opertaion will cause an LogException.11911192 :type project_name: string1193 :param project_name: the Project name 11941195 :type group_name: string1196 :param group_name: the group name list11971198 :return: GetMachineGroupAppliedConfigResponse1199 1200 :raise: LogException1201 """12021203 headers = {}1204 params = {}1205 resource = "/machinegroups/" + group_name + "/configs"1206 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1207 return GetMachineGroupAppliedConfigResponse(resp, header)12081209 def get_config_applied_machine_groups(self, project_name, config_name):1210 """ get machine group names where the logtail config applies to1211 Unsuccessful opertaion will cause an LogException.12121213 :type project_name: string1214 :param project_name: the Project name 12151216 :type config_name: string1217 :param config_name: the logtail config name used to apply12181219 :return: GetConfigAppliedMachineGroupsResponse1220 1221 :raise: LogException1222 """12231224 headers = {}1225 params = {}1226 resource = "/configs/" + config_name + "/machinegroups"1227 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1228 return GetConfigAppliedMachineGroupsResponse(resp, header)1229 def _update_acl(self, project_name, logstore_name, acl_action, acl_config) : 1230 headers = {}1231 params = {}1232 params['type'] = 'acl'1233 resource = "/"1234 if logstore_name != None and len(logstore_name) > 0 : 1235 resource = "/logstores/" + logstore_name1236 body = acl_config.to_json()1237 body['action'] = acl_action1238 body = json.dumps(body)1239 headers['Content-Type'] = 'application/json'1240 headers['x-log-bodyrawsize'] = str(len(body))1241 (resp, headers) = self._send("PUT", project_name, body, resource, params, headers)1242 return UpdateAclResponse(headers)12431244 def update_project_acl(self, project_name, acl_action, acl_config): 1245 """ update acl of a project1246 Unsuccessful opertaion will cause an LogException.12471248 :type project_name: string1249 :param project_name: the Project name 12501251 :type acl_action: string1252 :param acl_action: "grant" or "revoke", grant or revoke the acl_config to/from a project12531254 :type acl_config: acl_config.AclConfig1255 :param acl_config: the detail acl config info12561257 :return: UpdateAclResponse1258 1259 :raise: LogException1260 """12611262 return self._update_acl(project_name, None, acl_action, acl_config)12631264 def update_logstore_acl(self, project_name, logstore_name, acl_action, acl_config): 1265 """ update acl of a logstore1266 Unsuccessful opertaion will cause an LogException.12671268 :type project_name: string1269 :param project_name: the Project name 12701271 :type logstore_name: string1272 :param logstore_name: the logstore name12731274 :type acl_action: string1275 :param acl_action: "grant" or "revoke", grant or revoke the acl_config to/from a logstore12761277 :type acl_config: acl_config.AclConfig1278 :param acl_config: the detail acl config info12791280 :return: UpdateAclResponse1281 1282 :raise: LogException1283 """1284 return self._update_acl(project_name, logstore_name, acl_action, acl_config)128512861287 def _list_acl(self, project_name, logstore_name, offset = 0 , size = 100) : 1288 headers = {}1289 params = {}1290 params['type'] = 'acl'1291 params['offset'] = str(offset)1292 params['size'] = str(size)1293 resource = "/"1294 if logstore_name != None and len(logstore_name) > 0 : 1295 resource = "/logstores/" + logstore_name1296 (resp, headers) = self._send("GET", project_name, None, resource, params, headers)1297 return ListAclResponse(resp, headers)12981299 def list_project_acl(self, project_name, offset = 0 , size = 100) :1300 """ list acl of a project1301 Unsuccessful opertaion will cause an LogException.13021303 :type project_name: string1304 :param project_name: the Project name 13051306 :type logstore_name: string1307 :param logstore_name: the logstore name13081309 :type offset: int1310 :param offset: the offset of all acl13111312 :type size: int1313 :param size: the max return acl count13141315 :return: ListAclResponse1316 1317 :raise: LogException1318 """1319 return self._list_acl(project_name, None, offset, size)13201321 def list_logstore_acl(self, project_name, logstore_name, offset = 0 ,size = 100) :1322 """ list acl of a logstore1323 Unsuccessful opertaion will cause an LogException.13241325 :type project_name: string1326 :param project_name: the Project name 13271328 :type logstore_name: string1329 :param logstore_name: the logstore name13301331 :type offset: int1332 :param offset: the offset of all acl13331334 :type size: int1335 :param size: the max return acl count13361337 :return: ListAclResponse1338 1339 :raise: LogException1340 """13411342 return self._list_acl(project_name, logstore_name, offset, size)13431344 def create_shipper(self, project_name, logstore_name, shipper_name, shipper_type, shipper_config) : 1345 """ create odps/oss shipper1346 for every type, it only allowed one shipper1347 Unsuccessful opertaion will cause an LogException.13481349 :type project_name: string1350 :param project_name: the Project name 13511352 :type logstore_name: string1353 :param logstore_name: the logstore name13541355 :type shipper_name: string1356 :param shipper_name: the shipper name13571358 :type shipper_type: string1359 :param shipper_type: only support "odps" or "oss" 13601361 :type shipper_config : OssShipperConfig or OdpsShipperConfig 1362 :param shipper_config : the detail shipper config, must be OssShipperConfig or OdpsShipperConfig type13631364 :return: CreateShipperResponse1365 1366 :raise: LogException1367 """1368 headers = {}1369 params = {}1370 resource = "/logstores/" + logstore_name + "/shipper"1371 body = {}1372 body["shipperName"] = shipper_name1373 body["targetType"] = shipper_type1374 body["targetConfiguration"] = shipper_config.to_json()1375 body = json.dumps(body)1376 headers['Content-Type'] = 'application/json'1377 headers['x-log-bodyrawsize'] = str(len(body))13781379 (resp, headers) = self._send("POST", project_name, body, resource, params, headers)1380 return CreateShipperResponse(headers)13811382 def update_shipper(self, project_name, logstore_name, shipper_name, shipper_type, shipper_config) : 1383 """ update odps/oss shipper1384 for every type, it only allowed one shipper1385 Unsuccessful opertaion will cause an LogException.13861387 :type project_name: string1388 :param project_name: the Project name 13891390 :type logstore_name: string1391 :param logstore_name: the logstore name13921393 :type shipper_name: string1394 :param shipper_name: the shipper name13951396 :type shipper_type: string1397 :param shipper_type: only support "odps" or "oss" , the type must be same with the oringal shipper13981399 :type shipper_config : OssShipperConfig or OdpsShipperConfig 1400 :param shipper_config : the detail shipper config, must be OssShipperConfig or OdpsShipperConfig type14011402 :return: UpdateShipperResponse1403 1404 :raise: LogException1405 """1406 headers = {}1407 params = {}1408 resource = "/logstores/" + logstore_name + "/shipper/" + shipper_name1409 body = {}1410 body["shipperName"] = shipper_name1411 body["targetType"] = shipper_type1412 body["targetConfiguration"] = shipper_config.to_json()1413 body = json.dumps(body)1414 headers['Content-Type'] = 'application/json'1415 headers['x-log-bodyrawsize'] = str(len(body))14161417 (resp, headers) = self._send("PUT", project_name, body, resource, params, headers)1418 return UpdateShipperResponse(headers)14191420 def delete_shipper(self, project_name, logstore_name, shipper_name) :1421 """ delete odps/oss shipper1422 Unsuccessful opertaion will cause an LogException.14231424 :type project_name: string1425 :param project_name: the Project name 14261427 :type logstore_name: string1428 :param logstore_name: the logstore name14291430 :type shipper_name: string1431 :param shipper_name: the shipper name14321433 :return: DeleteShipperResponse1434 1435 :raise: LogException1436 """1437 headers = {}1438 params = {}1439 resource = "/logstores/" + logstore_name + "/shipper/" + shipper_name1440 (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)1441 return DeleteShipperResponse(header)1442 1443 def get_shipper_config(self, project_name, logstore_name, shipper_name) : 1444 """ get odps/oss shipper1445 Unsuccessful opertaion will cause an LogException.14461447 :type project_name: string1448 :param project_name: the Project name 14491450 :type logstore_name: string1451 :param logstore_name: the logstore name14521453 :type shipper_name: string1454 :param shipper_name: the shipper name14551456 :return: GetShipperConfigResponse1457 1458 :raise: LogException1459 """1460 headers = {}1461 params = {}1462 resource = "/logstores/" + logstore_name + "/shipper/" + shipper_name1463 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1464 return GetShipperConfigResponse(resp, header)14651466 def list_shipper(self, project_name, logstore_name) : 1467 """ list odps/oss shipper1468 Unsuccessful opertaion will cause an LogException.14691470 :type project_name: string1471 :param project_name: the Project name 14721473 :type logstore_name: string1474 :param logstore_name: the logstore name14751476 :return: ListShipperResponse1477 1478 :raise: LogException1479 """1480 headers = {}1481 params = {}1482 resource = "/logstores/" + logstore_name + "/shipper"1483 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1484 return ListShipperResponse(resp, header)1485 1486 def get_shipper_tasks(self, project_name, logstore_name, shipper_name, start_time, end_time, status_type = '', offset = 0, size = 100):1487 """ get odps/oss shipper tasks in a certain time range1488 Unsuccessful opertaion will cause an LogException.14891490 :type project_name: string1491 :param project_name: the Project name 14921493 :type logstore_name: string1494 :param logstore_name: the logstore name14951496 :type shipper_name: string1497 :param shipper_name: the shipper name14981499 :type start_time: int1500 :param start_time: the start timestamp15011502 :type end_time: int1503 :param end_time: the end timestamp 15041505 :type status_type : string1506 :param status_type : support one of ['', 'fail', 'success', 'running'] , if the status_type = '' , return all kinds of status type15071508 :type offset : int1509 :param offset : the begin task offset15101511 :type size : int1512 :param size : the needed tasks count 15131514 :return: ListShipperResponse1515 1516 :raise: LogException1517 """1518 headers = {}1519 params = {}1520 params["from"] = str(int(start_time))1521 params["to"] = str(int(end_time))1522 params["status"] = status_type1523 params["offset"] = str(int(offset))1524 params["size"] = str(int(size))1525 1526 resource = "/logstores/" + logstore_name + "/shipper/" + shipper_name + "/tasks"1527 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1528 return GetShipperTasksResponse(resp, header)15291530 def retry_shipper_tasks(self, project_name, logstore_name, shipper_name, task_list) : 1531 """ retry failed tasks , only the failed task can be retried1532 Unsuccessful opertaion will cause an LogException.15331534 :type project_name: string1535 :param project_name: the Project name 15361537 :type logstore_name: string1538 :param logstore_name: the logstore name15391540 :type shipper_name: string1541 :param shipper_name: the shipper name15421543 :type task_list: string array1544 :param task_list: the failed task_id list, e.g ['failed_task_id_1', 'failed_task_id_2',...], currently the max retry task count 10 every time 15451546 :return: RetryShipperTasksResponse1547 1548 :raise: LogException1549 """1550 headers = {}1551 params = {}1552 body = json.dumps(task_list)1553 headers['Content-Type'] = 'application/json'1554 headers['x-log-bodyrawsize'] = str(len(body))1555 resource = "/logstores/" + logstore_name + "/shipper/" + shipper_name + "/tasks"15561557 (resp, header) = self._send("PUT", project_name, body, resource, params, headers)1558 return RetryShipperTasksResponse(header)1559 1560 def create_project(self, project_name, project_des) : 1561 """ Create a project1562 Unsuccessful opertaion will cause an LogException.15631564 :type project_name: string1565 :param project_name: the Project name 15661567 :type project_des: string1568 :param project_des: the description of a project15691570 :return: CreateProjectResponse 15711572 :raise: LogException1573 """15741575 headers = {}1576 params = {}1577 body = {}1578 body["projectName"] = project_name1579 body["description"] = project_des15801581 body = json.dumps(body)1582 headers['Content-Type'] = 'application/json'1583 headers['x-log-bodyrawsize'] = str(len(body))1584 resource = "/"15851586 (resp, header) = self._send("POST", project_name, body, resource, params, headers)1587 return CreateProjectResponse(header)158815891590 def get_project(self, project_name) : 1591 """ get project1592 Unsuccessful opertaion will cause an LogException.15931594 :type project_name: string1595 :param project_name: the Project name 15961597 :return: GetProjectResponse 15981599 :raise: LogException1600 """1601 headers = {}1602 params = {}1603 body = {}1604 resource = "/"16051606 (resp, header) = self._send("GET", project_name, None, resource, params, headers)1607 return GetProjectResponse(resp, header)1608 1609 def delete_project(self, project_name):1610 """ delete project1611 Unsuccessful opertaion will cause an LogException.16121613 :type project_name: string1614 :param project_name: the Project name 16151616 :return: DeleteProjectResponse 16171618 :raise: LogException1619 """1620 headers = {}1621 params = {}1622 body = {}1623 resource = "/"16241625 (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)1626 return DeleteProjectResponse(header) ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful