diff --git a/exhausting_mturk/api.py b/exhausting_mturk/api.py index a4c136c..8ddc8ae 100644 --- a/exhausting_mturk/api.py +++ b/exhausting_mturk/api.py @@ -98,19 +98,22 @@ class Connection(): logger.debug(f"Save {answer_filename}") json.dump(assignment, fp, cls=DateTimeEncoder, indent=4) - if not confirm("Accept input of worker (no = reject!!)", True) and confirm("Are you sure you want to reject this user?! (reason in next step)", False): - # reject - reason = input("Reason for rejection (no newlines)") - response = self.mturk.reject_assignment( - AssignmentId=assignment['AssignmentId'], - RequesterFeedback=reason - ) - else: - response = self.mturk.approve_assignment( - AssignmentId=assignment['AssignmentId'] - # RequesterFeedback=reason - ) - + try: + if not confirm("Accept input of worker (no = reject!!)", True) and confirm("Are you sure you want to reject this user?! (reason in next step)", False): + # reject + reason = input("Reason for rejection (no newlines)") + response = self.mturk.reject_assignment( + AssignmentId=assignment['AssignmentId'], + RequesterFeedback=reason + ) + else: + response = self.mturk.approve_assignment( + AssignmentId=assignment['AssignmentId'] + # RequesterFeedback=reason + ) + except Exception as e: + logger.danger("ignoring exception on accepting/rejecting assignment!") + logger.exception(e) # save with new status after all processing is succesfull with open(hit_file, 'w') as fp: