Пример #1
0
	def get(self):
		contact_user_email= self.request.get('contact_user_email')
		user = None
		if self.request.cookies.get('our_token'):    #the cookie that should contain the access token!
			user = User.checkToken(self.request.cookies.get('our_token'))
		if not user:
			html = template.render("web/templates/index.html", {})
			self.response.write(html)
			return
		Contact.remove(user.key, contact_user_email)
		self.response.set_cookie('our_token', str(user.key.id()))
		self.response.write(json.dumps({'status':'OK'}))
		return
Пример #2
0
 def get(self):
     contact_user_email = self.request.get('contact_user_email')
     user = None
     if self.request.cookies.get(
             'our_token'
     ):  #the cookie that should contain the access token!
         user = User.checkToken(self.request.cookies.get('our_token'))
     if not user:
         html = template.render("web/templates/index.html", {})
         self.response.write(html)
         return
     Contact.remove(user.key, contact_user_email)
     self.response.set_cookie('our_token', str(user.key.id()))
     self.response.write(json.dumps({'status': 'OK'}))
     return
Пример #3
0
def delete_contact():
    """Remove a contact"""
    contact_id = int(input("Please enter contact id: "))
    Contact.remove(contact_id)
    print(f"Contact removed")