C#如何实现调用Python的URL接口-创新互联
今天就跟大家聊聊有关C#如何实现调用Python的URL接口,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

VS2013的简单WInForm控件,通过WebRequest,WebResponse来访问,接收:

private void btn_interface_Click(object sender, EventArgs e)
{
string url = "http://127.0.0.1:5000";
WebRequest wRequest = WebRequest.Create(url);
wRequest.Method = "GET";
wRequest.ContentType = "text/html;charset=UTF-8";
WebResponse wResponse = wRequest.GetResponse();
Stream stream = wResponse.GetResponseStream();
StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
string str = reader.ReadToEnd(); //url返回的值
reader.Close();
wResponse.Close();
} 当前名称:C#如何实现调用Python的URL接口-创新互联
链接URL:http://www.jxjierui.cn/article/jpsgo.html


咨询
建站咨询
