Omnis Studio and Python
Lou Picciano
loupicciano at comcast.net
Mon Dec 22 19:15:12 EST 2014
Serban, Derek, Greg et al,
Funny you guys happen to be on this, today.
Couple of thoughts:
1) +++ on Serban's point: requests is the New Way Forward here. Use it. httplib likely the also-ran at this point...
2) Serban, who are you - and why are you not at EurOmnis?
3) Derek, glad to have you on this Train of Thought.
Serban's point on data=[array] first, plus requisite authentication (Basic Auth?), is spot on.
Lou Picciano*
*(hesitant to call himself 'experienced' in this, has spent the last few days trying to get the whole lxml/etree/(etc) foodchain built - for use by one of the Omnis Luminaries - with static dependencies, of course, on multicore UNIX, using the Solaris linker. Head spinning.)
----- Original Message -----
From: serban21 at gmail.com
To: "OmnisDev List - English" <omnisdev-en at lists.omnis-dev.com>
Sent: Monday, December 22, 2014 1:05:41 PM
Subject: Re: Omnis Studio and Python
Hi
I'm working as a Python developer now, so I should be able to help...
The additional data should be passed in the request variable (in
data=request). That is supposed to be a dictionary, and it should be
populated before that call. Do you have that code?
See
http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests
.
Derek example is ok, but it's using another library than yours (httplib vs
requests). For this purpose, requests is much better.
Regards,
Serban Teodorescu
2014-12-22 19:53 GMT+02:00 Derek Delpero <derek.delpero at gmail.com>:
> Hi,
>
> Here's an example using a get request:
>
> import httplib
> conn = httplib.HTTPConnection("172.16.25.133:5921")
>
> conn.request("GET","/Ultra?OmnisLibrary=TestLibrary&OmnisClass=TestRemoteTask&test_parameter=1")
> res = conn.getresponse()
> data = res.read()
> conn.close()
>
> Hope that helps,
>
> Derek
>
>
> On Mon, Dec 22, 2014 at 10:54 AM, Grzegorz (Greg) Pasternak <
> grzegorz at niagara.com> wrote:
> >
> > Hello;
> > I am looking for some help re: Omnis Studio 4.x and up with Python.
> > Specifically I would like to run Python script against Omnis library
> using
> > HTTP ultra approach.
> > In archives I found reference to
> > Integrating Python With Omnis
> > http://omniscentral.com/integrating-python-with-omnis
> > but I can't seem to get more information.
> > I think this is the line in Python script that needs additional info
> about
> > Omnis library and Remote task class name:
> >
> > resp = requests.post(url=URL,data=request, auth=(USERNAME,PASSORD))
> >
> > Is anybody out there who has some experience with this and can help?
> > Please let me know,
> > Regards;
> > Greg
> >
> > _____________________________________________________________
> > Manage your list subscriptions at http://lists.omnis-dev.com
> >
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
>
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list