执行PATCH
请求的正确方法是flask-restless
什么?我收到以下响应错误:
{u'errors': [{u'status': 400, u'code': None, u'links': None, u'title': None, u'detail': u'Must specify correct data type', u'source': None, u'meta': None, u'id': None}], u'meta': {}, u'jsonapi': {u'version': u'1.0'}}
这是我的课:
class Stat(postgres.Model):
__tablename__ = 'stats'
def __init__(self,
res,
met,
cou
):
self.res = res
self.met = met
self.cou = cou
id = postgres.Column(postgres.Integer , primary_key=True , autoincrement=True)
res = postgres.Column(postgres.Enum('h' , 'd' m name='stat_res_enum') , nullable=False , unique=False)
met = postgres.Column(postgres.Enum('u_s' , 'o_t' , name='stat_met_enum') , nullable=False , unique=False)
cou = postgres.Column(postgres.BigInteger , nullable=False , unique=False)
这是我的要求:
data = {
"data":{
"attributes":{
"cou":3
}
}
}
response = requests.patch(url="http://127.0.0.1/api/stats/1",data=json.dumps(data),headers={'Accept' : 'application/vnd.api+json' , 'Content-Type' : 'application/vnd.api+json'})
response.json()