request.get和request.post輸出的東西不同?
2019/11/29 02:01 上午
Python網路爬蟲討論版
vivianoo
觀看數:3
回答數:2
收藏數:0
request.get
request.post
問題:
為什麼使用request.get和request.post,得到的output會不同?
code:
#使用request.get
odata_get = requests.get('http://odata.wra.gov.tw/v4/RealtimeWaterLevel')
json.loads(odata_get.text)
>>output:
{'@odata.context': 'http://odata.wra.gov.tw/v4/$metadata#RealtimeWaterLevel',
'@odata.count': 0,
'value': []}
#使用request.post
odata_post = requests.post('http://odata.wra.gov.tw/v4/RealtimeWaterLevel')
json.loads(odata_post.text)
>>output:
{'error': {'code': '',
'message': "No HTTP resource was found that matches the request URI 'http://wrisp2:88/odata/dataset/RealtimeWaterLevel'."}}