//using System.IO;
//using System.Text;
//using System.Net;
//using System.Net.Security;
static void Main(string[] args)
{
String method = "GET";
String url = "http://open-api-nlp.luzhi.online/NLP/GetLexer?token=***&text=下周三下午五点半去打球";
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = method;
try
{
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
Stream st = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("\n");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static void main(String[] args) throws IOException
{
String url = "http://open-api-nlp.luzhi.online/NLP/GetLexer?token=***&text=下周三下午五点半去打球";
HttpClient httpClient = HttpClients.custom().build();
HttpGet get = new HttpGet(url);
HttpResponse response = httpClient.execute(get);
HttpEntity resp_entity = response.getEntity();
resp_entity.getContent();
String resp_content = EntityUtils.toString(resp_entity,StandardCharsets.UTF_8);
System.out.println(resp_content);
}
import json, urllib
from urllib import urlencode
url = "http://*****"
params = {
"token": "*************", # 授权签名
"param1":"……" # 参数1
}
params = urlencode(params)
f = urllib.urlopen(url, params)
content = f.read()
res = json.loads(content)
if res:
print(res)
else:
print("请求异常")