예제 #1
0
 def getSubmissionId(self, premiseUserID):
     submissionID = ""
     try:
         httpCall = HttpCalls()
         jsonData = httpCall.sendGet(
             TaskService.getUserSubmissions + premiseUserID,
             ApiCoreUtil.authorizationToken, "GET")
         print("json Response getSubmissionId: ", jsonData)
         # submissionID =  super(TaskService, self).retrieveJSONValue(jsonData, "items")
         submissionID = super(TaskService,
                              self).retrieveSubmissionID(jsonData, "items")
         # submissionID = super(TaskService, self).iterate_all(jsonData, "key")
         # submissionID = super(TaskService, self).find("submissionId",jsonData)
         app = ApiCoreUtil()
         print("type>>>SSSSSSSSSSSSSSS", type(jsonData))
         # data = json.dumps(jsonData)
         # print("type>>>SSSSSSSSSSSSSSS", type(data))
         # submissionID = app.find123("submissionId", data)
         # submissionID =[]
         # submissionID = get_all_keys(jsonData)
         # self.mytest(jsonData)
         # submissionID = app.retrieveJSONValueTEST("items", jsonData)
         print(" Submission ID - ", submissionID)
         print(" typeSubmission ID - ", type(submissionID))
         print(" geteSubmission ID - ", submissionID)
     except:
         print("Exception encountered for getting Submission Id :::",
               sys.exc_info())
     return submissionID
예제 #2
0
 def setObservationId(self, submissionID, action):
     try:
         httpCall = HttpCalls()
         jsonData = httpCall.sendGet(
             TaskService.getCompletedTasks + submissionID,
             ApiCoreUtil.authorizationToken, "GET")
         print("Observation Data ::: ", jsonData)
         observationSet = self.getObservationIDs(jsonData, "observationId")
         for obsID in observationSet:
             print("obsID>>", obsID)
             jsonData1 = httpCall.sendPost(
                 TaskService.submitObservation.replace(
                     "SUBMISSIONID",
                     submissionID).replace("OBSERVATIONID", obsID),
                 ApiCoreUtil.authorizationToken, action)
         # itr = observationSet.iterator()
         # while(itr.hasNext()):
         #     observationID = itr.next().toString()
         #     print(observationSet)
         #     jsonData1 = httpCall.sendPost(TaskService.submitObservation.replace("SUBMISSIONID", submissionID).replace("OBSERVATIONID", observationID), ApiCoreUtil.authorizationToken, action)
     except:
         print("Exception encountered for submitting observationId :::",
               sys.exc_info())
         return False
     return True
예제 #3
0
    def getUser(self, emailID):
        premiseUserID = ""
        print("In getUser")
        try:

            if (super(UserService, self).getAutorizationToken() != None):
                httpCall = HttpCalls()
                str = UserService.getUserURL + emailID
                jsonObj = httpCall.sendGet(str, UserService.authorizationToken,
                                           "GET")
                print("Type of json>>", type(jsonObj))
                if jsonObj != None:
                    print("jsonObj result ::: ", jsonObj)
                    data = json.dumps(jsonObj)
                    print("type(data", type(data))
                    print("data = json.dumps(jsonObj) ", data)
                    if "User not found" not in data:
                        premiseUserID = super(UserService,
                                              self).retrieveJSONValue(
                                                  jsonObj,
                                                  UserService.jsonFlow)
                        print(" Premise User Id - ", premiseUserID)
                        print("PASSS")
                    else:
                        self.setUserGetErrorMsg(jsonObj)
                else:
                    print(
                        "Unable to get Premise User id:::Json object is NULL")
            else:
                print(
                    "Unable to get Premise user id:::Null Authorization token")
        except:
            print("Encountered exception while retrieving user idr:::",
                  sys.exc_info())

        return premiseUserID