Thanks it works...was calling extract on the wrong object...
I made it work with "urllib2" module also..
Here is the sample of working code, that others can use or improve upon.
Example of doing a HTTP post....using python interface from C++ and
reading the return response
------------------------------------------------------------------------
-----------------------
// do the following initially...
Py_Initialize() ;
boost::python::object http = boost::python::import("urllib2");
// the following code can be called any number of times...
try
{
std::strPostBody("<test/>"); // posting xml using
http-post..can be other stuff..
boost::python::object response = http
.attr("urlopen")(strURI.c_str(),strPostBody.c_str());
boost::python::object read = response.attr("read")();
std::string strResponse =
boost::python::extract
I am trying to connect to server that responds with XML. Here is the error I see: Traceback (most recent call last): File "<string>", line 1, in ? TypeError: unsubscriptable object
Again, try printing response: print response also, print type(response) That should be revealing. This is not a Boost.Python problem. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users