
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<char*>(read); } catch(...) { PyErr_Print(); PyErr_Clear(); } - Raja -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of David Abrahams Sent: Monday, August 20, 2007 2:02 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Can Python "httplib" module be directlyembeddedinC++ ? on Mon Aug 20 2007, "Raja Cherukuri" <raja-AT-transerainc.com> wrote:
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