def post(self): statusCode = 202 emailAddress = str(self.request.get('emailAddress')) content = json.loads(self.request.body) logging.info(content) weight = float(content['weight']) date = '' try: date = str(content['date']) except KeyError: date = '' newWeight = '' if date == '': newWeight = Weight(weight=weight, emailAddress=emailAddress) else: newWeight = Weight(weight=weight, emailAddress=emailAddress, dateTime=datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S.%f")) if newWeight: newWeight.put() statusCode = 200 self.response.write(json.dumps({'statusCode': statusCode}))