我一直在尝试向API发出请求,我必须通过以下正文:
{
"description":"Tenaris",
"ticker":"TS.BA",
"industry":"Metalúrgica",
"currency":"ARS"
}
Run Code Online (Sandbox Code Playgroud)
尽管代码似乎是正确的,并且它以"处理完成退出代码0"结束,但它运行不正常.我不知道我错过了什么,但这是我的代码:
http = urllib3.PoolManager()
http.urlopen('POST', 'http://localhost:8080/assets', headers={'Content-Type':'application/json'},
data={
"description":"Tenaris",
"ticker":"TS.BA",
"industry":"Metalúrgica",
"currency":"ARS"
})
Run Code Online (Sandbox Code Playgroud)
顺便说一句,这是使用Python的第一天,如果我不够具体,请原谅我.