擅长:python、mysql、java
<blockquote>
<p>If you want to keep using data argument you should parse data
dictionary to JSON to send the correct body format.</p>
</blockquote>
<p>您应该将<strong>标题设置为:</p>
<pre><code>headers = {
'Content-type': 'application/json'
}
</code></pre>
<p>完整代码为:</p>
<pre><code>import json
import requests
url = "https://www.meo.pt/_layouts/15/Ptsi.Isites.GridTv/GridTvMng.asmx/getProgramsFromChannels"
headers = {
'Content-type': 'application/json'
}
payload = {
"accountID": "",
"channels": [
"SCPHD",
"EURHD",
"EURS2HD",
"DISNY",
"CART",
"BIGGS",
"SICK",
"NICKELO",
"DISNYJ",
"PANDA",
],
"dateEnd": "2021-04-21T22:00:00.000Z",
"dateStart": "2021-04-20T22:00:00.000Z",
"service": "channelsguide",
}
resp = requests.post(url,headers=headers,data=json.dumps(payload))
print(resp.text)
</code></pre>