-1

Here is the REST server code:

@RequestMapping(value = "/create", method = RequestMethod.POST)
public MyObject create(@RequestBody Map<String, Object> myMap){
    String nameStr = (String) myMap.get("nameStr");
    String labelStr = (String) myMap.get("labelStr");
    return new MyObject(nameStr, labelStr);
}

How do I call this server by Python?

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

1 Answers1

-1

Using requests:

>>> import requests
>>> r = requests.post('http://yourserver.com/create',
...                   data = {'nameStr': 'Your Name', 'labelStr': 'Your Label'})
Laurent LAPORTE
  • 20,141
  • 5
  • 53
  • 92