def test_is_success(self):
        s1 = 'OK'
        s2 = 'fail'
        self.assertTrue(AntchainUtils.is_success(s1, s2))

        s1 = 'fail'
        s2 = 'OK'
        self.assertFalse(AntchainUtils.is_success(s1, s2))

        s1 = 'fail'
        s2 = 'fail'
        self.assertTrue(AntchainUtils.is_success(s1, s2))
Example #2
0
 async def upload_merchant_image_ex_async(
     self,
     request: industry_models.UploadMerchantImageRequest,
     headers: Dict[str, str],
     runtime: util_models.RuntimeOptions,
 ) -> industry_models.UploadMerchantImageResponse:
     """
     Description: 行业商家图片上传
     Summary: 行业商家图片上传
     """
     if not UtilClient.is_unset(request.file_object):
         upload_req = industry_models.CreateAntcloudGatewayxFileUploadRequest(
             auth_token=request.auth_token,
             api_code='antcloud.industry.merchant.image.upload',
             file_name=request.file_object_name
         )
         upload_resp = await self.create_antcloud_gatewayx_file_upload_ex_async(upload_req, headers, runtime)
         if not AntchainUtils.is_success(upload_resp.result_code, 'ok'):
             upload_merchant_image_response = industry_models.UploadMerchantImageResponse(
                 req_msg_id=upload_resp.req_msg_id,
                 result_code=upload_resp.result_code,
                 result_msg=upload_resp.result_msg
             )
             return upload_merchant_image_response
         upload_headers = AntchainUtils.parse_upload_headers(upload_resp.upload_headers)
         await AntchainUtils.put_object_async(request.file_object, upload_headers, upload_resp.upload_url)
         request.file_id = upload_resp.file_id
     UtilClient.validate_model(request)
     return industry_models.UploadMerchantImageResponse().from_map(
         await self.do_request_async('1.0', 'antcloud.industry.merchant.image.upload', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
     )
Example #3
0
 async def echo_gateway_check_ex_async(
     self,
     request: demo_models.EchoGatewayCheckRequest,
     headers: Dict[str, str],
     runtime: util_models.RuntimeOptions,
 ) -> demo_models.EchoGatewayCheckResponse:
     """
     Description: Demo接口,返回当输入的值
     Summary: 返回输入值
     """
     if not UtilClient.is_unset(request.file_object):
         upload_req = demo_models.CreateAntcloudGatewayxFileUploadRequest(
             api_code='demo.gateway.check.echo')
         upload_resp = await self.create_antcloud_gatewayx_file_upload_ex_async(
             upload_req, headers, runtime)
         if not AntchainUtils.is_success(upload_resp.result_code, 'OK'):
             echo_gateway_check_response = demo_models.EchoGatewayCheckResponse(
                 req_msg_id=upload_resp.req_msg_id,
                 result_code=upload_resp.result_code,
                 result_msg=upload_resp.result_msg)
             return echo_gateway_check_response
         upload_headers = AntchainUtils.parse_upload_headers(
             upload_resp.upload_headers)
         await AntchainUtils.put_object_async(request.file_object,
                                              upload_headers,
                                              upload_resp.upload_url)
         request.file_id = upload_resp.file_id
     UtilClient.validate_model(request)
     return demo_models.EchoGatewayCheckResponse().from_map(
         await self.do_request_async('1.0', 'demo.gateway.check.echo',
                                     'HTTPS', 'POST', f'/gateway.do',
                                     TeaCore.to_map(request), headers,
                                     runtime))