我有一个简单的Java REST Web服务-@GET
@Path("/get1")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Status getstudent(Track track) {
System.out.println("GET1 title = " + track.getTitle());
System.out.println("GET1 singer = " + track.getSinger());
Status status = new Status();
status.setStatus_flag("success");
return status;
}
轨道
^{pr2}$
Python请求模块:-在import requests
title = {"title":"Best Songs","singer":"lucky"}
r = requests.get("http://localhost:8080/StudentService/rest/insert/get1",data=title)
print r.content
错误
HTTP Status 415 - Unsupported Media Type
type Status report
message Unsupported Media Type
description
The server refused this request because the request entity is
in a format not supported by the requested resource for the requested
method.
Apache Tomcat/6.0.41
有没有办法创建实体对象并发送它?在