APIURL ='http://localhost:6543/api/patches/alice_8b84090712bce46e15a8107839cefe/e5678'
data = {
'patch_id' : 'e5678',
'queue_id' : 'alice_8b84090712bce46e15a8107839cefe',
}
response = requests.get(APIURL, data=data)
我有上面的代码来测试一个檐口金字塔 REST api。
但是我无法读取通过data=data
参数输入的数据。
这是此端点的服务器功能:
@resource(collection_path='/api/patches', path="/api/patches/{queue_id}/{patch_id}")
class Patch(object):
def __init__(self, request):
self.request = request
def get(self):
"""
"""
queue_id = self.request.matchdict.get('queue_id', '')
patch_id = self.request.matchdict.get('patch_id', '')
data = {
'queue_id': 'e12525e1f90ad5e7395a965',
'patch_id': 'a9651a8259a666c0032f343',
'node_id': 'bef3a2adc76415b2be0f6942b5111f6c5e5b7002',
'message': 'This is a patch on feature2.',
'datetime': '.....',
}
#TODO call the patch method to get the public attributes
return {'error':{}, 'data': data}