我尝试使用requests.get尝试访问Django中的Web服务,但我在api的网址上有一个MissingSchema,
searchin = 'something'
myurl = 'api.webservice.com/search?name='+searchin+'&APIID=abcd'
r = requests.get(myurl)
答案 0 :(得分:0)
长话短说,只需在api.webservice(..)之前添加http://或https://
searchin = 'something'
myurl = 'http://api.webservice.com/search?name='+searchin+'&APIID=abcd'
r = requests.get(myurl)
检查RFC的URI:https://tools.ietf.org/html/rfc3986#section-3.1 https://en.wikipedia.org/wiki/Uniform_Resource_Identifier