我无法将Python转换为VB.NET:
import requests
multiple_files = {'pic': ('1111111.jpg', open( r'0180905172943.jpg', 'rb'), 'image/jpg')}
resp = requests.post(r'http://ocr.shouji.sogou.com/v2/ocr/json', files=multiple_files)
str_json = resp.json()
print(str_json)
这是vb.net代码
Dim Items As New Dictionary(Of String, String)
Items.Add("pic", "0180905172943.jpg")
Items.Add("image/jpg", "")
Dim params As String = JsonConvert.SerializeObject(Items, Formatting.None)
Dim Uri As New Uri(String.Format("http://ocr.shouji.sogou.com/v2/ocr/json"))
Dim webClient As New WebClient()
Dim resByte As Byte()
Dim resString As String
Dim reqString() As Byte
webClient.Headers("content-type") = "application/json"
Dim senddata As Object = JsonConvert.SerializeObject(New With {Key .param = params}).ToString()
reqString = Encoding.Default.GetBytes(senddata)
resByte = webClient.UploadData(Uri, "post", reqString)
resString = Encoding.Default.GetString(resByte)
对吗?结果什么都没有。