import agent.config.parameter as parameter from datetime import datetime, timedelta from agent.log.myLog import MyLog # Test variable RES_THRESHOLD = timedelta(seconds=parameter.REQ_THRESHOLD_SECS()) ACCOUNT = '*****@*****.**' PASSWORD = '******' URI = 'mpus.com.us' MY_DLINK_ID = '111114' MY_DLINK_ID_2ND = '111115' SITE = 'usmp' # Log handle LOGGING = MyLog() LOGGING.removeAllLogHandler() CLIENT_ID = parameter.APP_ID() CLIENT_SECRET = parameter.APP_SECRET() DEV_LIST = [MY_DLINK_ID, MY_DLINK_ID_2ND] class BaseApiTest(unittest.TestCase): def setUp(self): LOGGING.info('Current testing: {}'.format(self.id().split('.')[-1])) def tearDown(self): LOGGING.info('End testing: {}'.format(self.id().split('.')[-1])) LOGGING.info('') LOGGING.info('')
#!/usr/bin/python3 import json import requests import agent.api.openapi as openapi from agent.log.myLog import MyLog LOGGING = MyLog() def func_cnvr11_****(uri, access_token, mydlink_id, sub_id, start_ts, end_ts): api = 'REMOVE FOR CREDENTIAL' my_params = { 'REMOVE FOR CREDENTIAL': 'REMOVE FOR CREDENTIAL' } data = { 'REMOVE FOR CREDENTIAL': 'REMOVE FOR CREDENTIAL' } r = requests.post( 'https://{}{}'.format(uri, api), params=my_params, data=json.dumps(data), headers={'Content-Type': 'application/json'} ) openapi.print_api_res(r) return r def func_cnvr12_****(uri, session_id): api = 'REMOVE FOR CREDENTIAL' my_params = {
import agent.config.parameter as parameter from datetime import datetime, timedelta from agent.log.myLog import MyLog # Test variable RES_THRESHOLD = timedelta(seconds=parameter.REQ_THRESHOLD_SECS()) ACCOUNT = '{{REPLACE_TO_ACCOUNT}}' PASSWORD = '******' URI = '{{REPLACE_TO_URI}}' MY_DLINK_ID = '{{REPLACE_TO_DEV1}}' MY_DLINK_ID_2ND = '{{REPLACE_TO_DEV2}}' SITE = '{{REPLACE_TO_SITE}}' # Log handle LOGGING = MyLog() LOGGING.removeAllLogHandler() LOGTS = time.strftime("%Y%m%d%H%M") LOGGING.logToFile('/log/' + SITE + '_api_response_' + LOGTS + '.log') CLIENT_ID = parameter.APP_ID() CLIENT_SECRET = parameter.APP_SECRET() DEV_LIST = [MY_DLINK_ID, MY_DLINK_ID_2ND] class BaseApiTest(unittest.TestCase): def setUp(self): LOGGING.info('Current testing: {}'.format(self.id().split('.')[-1])) def tearDown(self): LOGGING.info('End testing: {}'.format(self.id().split('.')[-1]))