[問題] POSTMAN和python跑request結果不一致
先前有問問題,承蒙幾位前輩指正
所以做了一些測試
先以postman送https post,順利執行成功
但用python用request去送,卻出現
Failed to establish a new connection: [WinError 10060]
所以試著用wireshark去抓封包觀察
發現兩者在最初的standard query和回應的standard query response都長一樣
但下一步卻connect到不同的地方
postman是正確的CONNECT到我請求的API位址
但python request卻是CONNECT到mobile.events.data.microsoft.com
一整個超莫名其妙
覺得問題應該就出在這裡,但完全不知道如何解決
不曉得該怎麼解決這個問題
有勞高手指點><
python code是長下面這樣(私密資料已代換):
import requests
import json
url = https://API位址
payload = json.dumps({
"to": "XXXXXX",
"messages": [
{
"type": "text",
"text": "測試訊息"
}
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 認證資料
}
response = requests.request("POST", url=url, headers=headers, data=payload)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.71.217.244 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1728629548.A.458.html
推
10/11 15:03,
1月前
, 1F
10/11 15:03, 1F
→
10/11 15:28,
1月前
, 2F
10/11 15:28, 2F
→
10/11 15:28,
1月前
, 3F
10/11 15:28, 3F
→
10/11 16:34,
1月前
, 4F
10/11 16:34, 4F
→
10/11 16:34,
1月前
, 5F
10/11 16:34, 5F
→
10/11 16:37,
1月前
, 6F
10/11 16:37, 6F
→
10/11 16:37,
1月前
, 7F
10/11 16:37, 7F
→
10/11 16:37,
1月前
, 8F
10/11 16:37, 8F
→
10/11 16:37,
1月前
, 9F
10/11 16:37, 9F
→
10/11 16:38,
1月前
, 10F
10/11 16:38, 10F
→
10/11 16:38,
1月前
, 11F
10/11 16:38, 11F
→
10/11 16:43,
1月前
, 12F
10/11 16:43, 12F
→
10/11 16:44,
1月前
, 13F
10/11 16:44, 13F
→
10/11 16:44,
1月前
, 14F
10/11 16:44, 14F
→
10/11 16:44,
1月前
, 15F
10/11 16:44, 15F
→
10/11 16:44,
1月前
, 16F
10/11 16:44, 16F
→
10/11 17:07,
1月前
, 17F
10/11 17:07, 17F
→
10/11 17:08,
1月前
, 18F
10/11 17:08, 18F
→
10/11 17:08,
1月前
, 19F
10/11 17:08, 19F
→
10/11 17:09,
1月前
, 20F
10/11 17:09, 20F
→
10/11 17:10,
1月前
, 21F
10/11 17:10, 21F
→
10/11 17:10,
1月前
, 22F
10/11 17:10, 22F
→
10/11 17:59,
1月前
, 23F
10/11 17:59, 23F
→
10/11 17:59,
1月前
, 24F
10/11 17:59, 24F
→
10/11 17:59,
1月前
, 25F
10/11 17:59, 25F
→
10/11 18:15,
1月前
, 26F
10/11 18:15, 26F
→
10/11 21:24,
1月前
, 27F
10/11 21:24, 27F
推
10/12 08:44,
1月前
, 28F
10/12 08:44, 28F
→
10/12 08:44,
1月前
, 29F
10/12 08:44, 29F
→
10/12 08:44,
1月前
, 30F
10/12 08:44, 30F
→
10/19 21:35,
4周前
, 31F
10/19 21:35, 31F
→
10/21 15:09,
3周前
, 32F
10/21 15:09, 32F
→
10/21 15:09,
3周前
, 33F
10/21 15:09, 33F
→
10/21 15:09,
3周前
, 34F
10/21 15:09, 34F
→
10/21 15:10,
3周前
, 35F
10/21 15:10, 35F
→
10/21 15:10,
3周前
, 36F
10/21 15:10, 36F
→
10/21 18:05,
3周前
, 37F
10/21 18:05, 37F
→
10/21 18:05,
3周前
, 38F
10/21 18:05, 38F
→
10/21 18:05,
3周前
, 39F
10/21 18:05, 39F
→
10/21 18:05,
3周前
, 40F
10/21 18:05, 40F
→
10/21 18:57,
3周前
, 41F
10/21 18:57, 41F
→
10/21 18:57,
3周前
, 42F
10/21 18:57, 42F
→
10/21 18:57,
3周前
, 43F
10/21 18:57, 43F
→
10/21 18:57,
3周前
, 44F
10/21 18:57, 44F
→
10/21 18:57,
3周前
, 45F
10/21 18:57, 45F
推
10/21 19:03,
3周前
, 46F
10/21 19:03, 46F
→
10/21 19:03,
3周前
, 47F
10/21 19:03, 47F
→
10/21 19:03,
3周前
, 48F
10/21 19:03, 48F
→
10/21 19:03,
3周前
, 49F
10/21 19:03, 49F
→
10/21 19:03,
3周前
, 50F
10/21 19:03, 50F
→
10/21 19:17,
3周前
, 51F
10/21 19:17, 51F
→
10/21 19:17,
3周前
, 52F
10/21 19:17, 52F
→
10/21 19:21,
3周前
, 53F
10/21 19:21, 53F
→
10/21 19:21,
3周前
, 54F
10/21 19:21, 54F
→
10/21 19:21,
3周前
, 55F
10/21 19:21, 55F
→
10/21 19:28,
3周前
, 56F
10/21 19:28, 56F
→
10/21 19:28,
3周前
, 57F
10/21 19:28, 57F
→
10/21 19:31,
3周前
, 58F
10/21 19:31, 58F
→
10/21 19:31,
3周前
, 59F
10/21 19:31, 59F
→
10/21 21:11,
3周前
, 60F
10/21 21:11, 60F
→
10/21 21:11,
3周前
, 61F
10/21 21:11, 61F
→
10/21 21:11,
3周前
, 62F
10/21 21:11, 62F
→
10/21 21:11,
3周前
, 63F
10/21 21:11, 63F
→
10/23 18:49,
3周前
, 64F
10/23 18:49, 64F
→
10/28 14:39,
2周前
, 65F
10/28 14:39, 65F
→
10/28 14:40,
2周前
, 66F
10/28 14:40, 66F
→
10/28 17:06,
2周前
, 67F
10/28 17:06, 67F
→
10/28 17:07,
2周前
, 68F
10/28 17:07, 68F
Python 近期熱門文章
PTT數位生活區 即時熱門文章