HI
I am not getting response when i call the API call for the first time in day (it calls action class and wait for it to response and finally gives response as down even though the api works fine in postmen) i tried lot of methods but still i did not find what is the reason for this issue.Can you please help me with this.
below is error i am getting at which api calls get fail:
common_url https://xxxxxx/xxx-xxx/api/secure/v1/user/landing
***********paramsLanding************* {'userId': 'myusername', 'requestHeader': {'securityCredential': {'userName': 'myusername', 'securityToken': 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzdXJ5YTE5OTMiLCJqdGkiOiJzdXJ5YTE5OTMiLCJ1c2VyTmFtZSI6InN1cnlhMTk5MyIsImlhdCI6MTU2ODI4NTMzNywiZXhwIjoxNTY4MjkyNTM3fQ.0vRG_JP3IXoE6X2acgOx3_96o5xYMYyfXVN5IBNXIUI'}}}
***********inputDataLanding************* {"userId": "myusername", "requestHeader": {"securityCredential": {"userName": "myusername", "securityToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzdXJ5YTE5OTMiLCJqdGkiOiJzdXJ5YTE5OTMiLCJ1c2VyTmFtZSI6InN1cnlhMTk5MyIsImlhdCI6MTU2ODI4NTMzNywiZXhwIjoxNTY4MjkyNTM3fQ.0vRG_JP3IXoE6X2acgOx3_96o5xYMYyfXVN5IBNXIUI"}}}
2019-09-12 06:48:57 DEBUG urllib3.connectionpool - Starting new HTTPS connection (1): myappapi.dev5.awse1.mycompany.com:443
/u01/app/anaconda3/envs/rasa/lib/python3.6/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
actions.py:
class ActionOutAmontpreProcess(Action):
def name(self):
# define the name of the action which can then be included in training stories
return "action_outstanding_amount_preprocess"
def run(self, dispatcher, tracker, domain):
print("****User login validation started***")
user_id= tracker.get_slot('user_id')
password= tracker.get_slot('password')
common_url=tracker.get_slot('common_url')
print("The user_id is",user_id)
print("The password is",password)
print("The common Url is",common_url)
API_ENDPOINT= common_url+"/xxx-xxx/api/public/v1/user/myappLogin"
print("common_url for preprocess",API_ENDPOINT)
params={"userName":user_id,"password":password}
inputData=json.dumps(params)
try:
response = json.loads(requests.post(url=API_ENDPOINT,data=inputData,verify=False).text)
statusCheck=response["loginStatus"]
print(statusCheck)
API_ENDPOINT_JWT= common_url+"/xxx-xxx/api/secure/v1/user/generateJWTToken"
print("API_ENDPOINT_JWT",API_ENDPOINT_JWT)
paramsjwt={"userId":user_id,"requestHeader":{"appId":"EEA","securityCredential":{"userName":user_id,"securityToken":""}}}
print("paramsjwt",paramsjwt)
inputjwt=json.dumps(paramsjwt)
responsejwt = json.loads(requests.post(url=API_ENDPOINT_JWT,data=inputjwt,verify=False).text)
jwt_token=responsejwt["jwtToken"]
print("jwt_token",jwt_token)
if(statusCheck=="SUCCESS"):
print("*******Login Success ************")
API_ENDPOINT_Landing_Response= common_url+"/xxx-xxx/api/secure/v1/user/landing"
print("user_id",user_id)
print("common_url",API_ENDPOINT_Landing_Response)
paramsLanding={"userId":user_id,"requestHeader":{"securityCredential":{"userName":user_id,"securityToken":jwt_token}}}
print("***********paramsLanding*************",paramsLanding)
inputDataLanding=json.dumps(paramsLanding)
print("***********inputDataLanding*************",inputDataLanding)
api=requests.post(url=API_ENDPOINT_Landing_Response,data=inputDataLanding,verify=False)
print("success",api)
responseLanding = json.loads(api.text)
print("success",responseLanding)
group_number=responseLanding["myappUserAccessDetails"][0]["groupNumber"]
firstName=responseLanding["firstName"]
lastName=responseLanding["lastName"]
user_name=firstName+lastName
Email=responseLanding["emailAddress"]
groupname=responseLanding["myappUserAccessDetails"][0]["groupName"]
print("group Number is",group_number)
print("User Name is",user_name)
print("Email",Email)
print("groupname",groupname)
return [SlotSet("group_num",group_number),SlotSet("user_name",user_name),SlotSet("Email_address",Email),SlotSet("group_name",groupname),SlotSet("err_reason","noerror")]
else:
#dispatcher.utter_message("The User ID or Password entered is Incorrect.")
print("Loginfailed")
return[SlotSet("err_reason","loginfail")]
except:
print("Error",sys.exc_info()[0])
print("******* System is down at this point of time ******")
checkValue="bill empty"
return [SlotSet("err_reason",checkValue)]