def verify_service(service, code): p = get_object_or_404(PublicId, PublicId.idtype == service, PublicId.code == code) if p.code_expored_date < datetime.now(): p.refresh_code() p = p.update_obj() p.resend_code() raise ValueError("Code expired") p.accept_veiry() Response(json.dumps({"status": "ok"}, default=json_serial), status=200, mimetype="application/json")
def get(): account, service = request.form.get('account'), request.form.get('service') if not account: account, service = request.json.get('account'), request.json.get('service') publicid = get_object_or_404(PublicId, PublicId.account == account, PublicId.idtype == service) return Response(json.dumps({"key": publicid.key.first().publickey}, default=json_serial), status=200, mimetype="application/json")