[mod_python] How do I do this - mimic a browser calling javascript

Bart scarfboy at gmail.com
Wed Jan 16 07:33:57 EST 2008


On Jan 16, 2008 1:34 AM, happybrowndog <happybrowndog at hotmail.com> wrote:
> How do I do this?
>
> I'm running mod_python.  The apache server is also a proxy for another
> web server.  In one of my mod_python scripts, I need to mimic a browser
> and call into the proxied web server... specifically, I need to make a
> javascript call.  I'm not concerned about the result of the call, other
> than to know it worked.  The javascript call in question is:
>
> dojox.cometd.publish('/channel', json_object);
>
> which requires includes of several javascript source files.
>
> I looked into urllib and saw only things to do POST and GET, which is
> not suitable.

Well, AJAX *is* just POST or GET, if usually with a little code to make it
easier to do certain things. I don't use dojo, but it looks like most of what
you need here is to serialize that object, which is probably simple enough
to mimic with python code.

Given, of course, that you know exactly what the javascript version does,
(in terms of variable naming, possible wrapping and such).
Maybe the dojox docs will tell you, otherwise you can probably figure it out
with something like firebug, fiddler, or Tamper Data.


Regards,
--Bart


More information about the Mod_python mailing list