-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
  • 115,751
  • 26
  • 228
  • 437

1 Answers1

-1

Using requests:

>>> import requests
>>> r = requests.post('http://yourserver.com/create',
...                   data = {'nameStr': 'Your Name', 'labelStr': 'Your Label'})
Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103