0
我正在發送HTTP POST請求。HTTP發佈請求錯誤HTTPError:錯誤的請求
我的數據由一個字典的兩個條目:在詞典
- 一個值是一個字符串
- 另一個值是一個字符串數組。
我知道URL是有效的,但我不斷收到:
HTTPError: Bad Request
任何人都可以找出我要去的地方錯了嗎?
from urllib.parse import urlencode
from urllib.request import Request, urlopen
array_of_strings = ["yrrt", "rtgh", "erte", "eregee"]
url_4 = 'http:// someurl'
data_4 ={"key": "value", "array": array_of_strings}
request_4 = Request(url_4, urlencode(data_4).encode())
response = urlopen(request_4).read().decode()
print(response)