1
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。金字塔讀取http數據
但是,我無法讀取通過參數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}