import requests
import json
data = {
'act': '',
'pw': '',
'req': 'grades',
}
response = requests.post('http://127.0.0.1:5000/', data=data)
print(response.text)
这是无法正常工作的JavaScript代码
useEffect(() => {
fetch('http://127.0.0.1:5000/', {
method: 'POST',
body: new URLSearchParams({
'act': '',
'pw': '',
'req': 'grades'
})
}).then(response => {
console.log('Response:', response)
return response.json();
}).then(response => console.log(response))
}, []);
他们发送了完全相同的请求,但要获得不同的回复
应该看起来像什么(运行Python Code时我得到的是什么 当我运行JavaScript代码时会发生什么 to Rebrence这是我的API的GitHub回购 https://github.com/amaheshwari01/powerscraper
对象并查看是否有效。const formData = new FormData();
formData.append('act', '');
formData.append('pw', '');
formData.append('req', 'grades');
fetch('http://127.0.0.1:5000/', {
method: 'POST',
body: formData
})
.then(response => {
console.log('Response:', response)
return response.json();
}).then(response => console.log(response))