|
Boost Users : |
From: Raja Cherukuri (raja_at_[hidden])
Date: 2007-08-17 20:04:51
Thanks it works fine...how do check the return response...
Using extract<string> or <extract<char*> doesn't seem to help..
Am I doing something wrong ? Here is the code:
boost::python::object response =
gpPythonHttp->attr("urlopen")(m_sURI.c_str(),strXMLOutput.c_str());
boost::python::exec("result = read()", response);
std::string res =
boost::python::extract<std::string>(response["result"]);
-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of David Abrahams
Sent: Tuesday, August 14, 2007 4:15 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Can Python "httplib" module be directly
embeddedin C++ ?
on Tue Aug 14 2007, "Raja Cherukuri" <raja-AT-transerainc.com> wrote:
> Hello,
> I am trying to use python to do my XML post ?
> Can I do this by directly calling import on the httplib like this and
> setting parameters ?
>
> ex:
> boost::python::object
>
http_module((boost::python::handle<>(boost::python::borrowed(PyImport_Ad
> dModule("httplib")))));
boost::python::object http_module = boost::python::import("httplib");
> boost::python::<....some kind of python compile time...interface...>
h
> = < some kind of cast...>
>
> http_module.HTTP("http://www.abc.com");
http_module.attr("HTTP")("http://www.abc.com");
> h.putrequest('POST', selector)
ditto, etc.
> h.putheader('content-type', content_type)
> h.putheader('content-length', str(len(body)))
> h.endheaders()
> h.send(body)
>
>
> Or should the actual code for this object reside in a text file and I
> should call exec_file ?
You can do that too.
HTH,
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net