我想调用一个看起来像这样的api端点
http://api.example.com/user/jhon+doe?field=full&key=somestring
。当我使用python请求调用此url时,由于用户名错误,我总是得到错误的结果。这是我的代码
import requests as req
url = 'http://api.example.com/user/jhon+doe?field=full&key=somestring'
r = req.get(ur)
data = r.json() # return wrong result
print r.url # output wrong url ,, http://api.example.com/user/jhon