为了正确执行 requests.post 函数,需要在代码中放入哪些参数?
What parameters need to be put in the code in order to execute correctly the requests.post function?
这个站点(www.pyszne.pl)需要设置什么参数才能正常执行requests函数?我需要一个 url 来找到特定邮政编码下可用的餐厅。
这是我的代码:
import requests
payload = {'myvaluestring':'30-529'}
r = requests.post('https://www.pyszne.pl', data=payload)
print(r.url)
我只收到相同的主页url https://www.pyszne.pl/
这是 GET
的情况,而不是 POST
。试试这个:
In [1]: import requests
In [2]: r = requests.get("https://www.pyszne.pl/30-529")
In [3]: r.url
Out[3]: 'https://www.pyszne.pl/restauracja-krakow-krakow-podgorze-30-529'
我建议你在网上搜索"what's the difference of HTTP POST and GET"。
这个站点(www.pyszne.pl)需要设置什么参数才能正常执行requests函数?我需要一个 url 来找到特定邮政编码下可用的餐厅。
这是我的代码:
import requests
payload = {'myvaluestring':'30-529'}
r = requests.post('https://www.pyszne.pl', data=payload)
print(r.url)
我只收到相同的主页url https://www.pyszne.pl/
这是 GET
的情况,而不是 POST
。试试这个:
In [1]: import requests
In [2]: r = requests.get("https://www.pyszne.pl/30-529")
In [3]: r.url
Out[3]: 'https://www.pyszne.pl/restauracja-krakow-krakow-podgorze-30-529'
我建议你在网上搜索"what's the difference of HTTP POST and GET"。