import json def updateSentNotifications(inboundPlanId): with open('SentNotifications.json') as sentNotificationsJSON: sentNotifications = json.load(sentNotificationsJSON) sentNotifications['sentNotifications'].append(inboundPlanId) with open('SentNotifications.json', mode='w') as outputSentNotifications: outputSentNotifications.write(json.dumps(sentNotifications, indent=4)) def isInboundShipmentPlanIDInSentNotifications(inboundShipmentPlanId): with open('SentNotifications.json') as sentNotificationsJSON: sentNotifications = json.load(sentNotificationsJSON) if inboundShipmentPlanId in sentNotifications['sentNotifications']: return True else: return False