Relative Content

Tag Archive for pythonflaskdecodeencode

Flask ??? instead of the Cyrillic alphabet

from flask import request from flask_restful import Resource from models import db, Infrastructure class InfrastructureResource(Resource): def get(self, id=None): if id: infra = Infrastructure.query.get_or_404(id) return {“id”: infra.id, “name”: infra.name, “location”: infra.location} else: infra_list = Infrastructure.query.all() return [{“id”: infra.id, “name”: infra.name, “location”: infra.location} for infra in infra_list] def post(self): data = request.get_json() new_infra = Infrastructure( name=data[‘name’], location=data[‘location’] […]