Python 如何基于抽象类和restful在类中设置构造函数

Python 如何基于抽象类和restful在类中设置构造函数,python,python-3.x,rest,flask,abstract-class,Python,Python 3.x,Rest,Flask,Abstract Class,嗨,我对烧瓶和创建rest应用程序有点小问题。 问题是我不知道如何以正确的方式传递数据 class Chessman(object): __metaclass__ = ABCMeta def __init__(self, currentField): self.currentField = currentField x,y = self.currentField self.x,self.y = ord(x)-97,8-int(y)

嗨,我对烧瓶和创建rest应用程序有点小问题。 问题是我不知道如何以正确的方式传递数据

class Chessman(object):
    __metaclass__ = ABCMeta

    def __init__(self, currentField):
        self.currentField = currentField
        x,y = self.currentField
        self.x,self.y = ord(x)-97,8-int(y)
        super().__init__()

    @abstractmethod
    def list_available_moves(self):pass

    def validate_move(self,dest_field):
        return dest_field in self.list_available_moves()


class King(Chessman,Resource):
    def list_available_moves(self):
        return None

api.add_resource(King, '/api/<string:figure>/<string:currentField>')
类棋子(对象):
__元类_uu=ABCMeta
定义初始化(自身,当前字段):
self.currentField=currentField
x、 y=自电流场
self.x,self.y=ord(x)-97,8-int(y)
super()。\uuuu init\uuuuu()
@抽象方法
def列表可用移动(自身):通过
def验证移动(自身、目的地字段):
返回self.list\u available\u moves()中的dest\u字段
类王(棋子,资源):
def列表\u可用\u移动(自):
一无所获
api.add_资源(King,“/api/”)
不知道如何正确设置它