Hi Darius,
I have another issue with proxies.
For proxy usage, suds needs a proxy option which must be set like this:
from suds.client import Client
from suds.cache import NoCache
wsdl=3D'http://wdsl.example.com/?wdsl'
*proxies =3D {'http': 'proxy.example.com:3128'}*
cli =3D Client(wsdl, cache=3DNoCache(), *proxy=3Dproxies*)
Suds cares neither misc.http_proxy settings nor os_environ.http_proxy
settings. I have to tell suds proxy as above and it works perfectly.
Is there any way to make Zato’s suds proxy usage as above?
Thanks.
On 31 October 2015 at 13:39, Dariusz Suchojad dsuch@zato.io wrote:
On 31/10/15 12:22, Ali R=C4=B1za KELE=C5=9E wrote:
https://github.com/zatosource/zato/issues/495
This is important for my case. I can write some lines of code for zato.
I will fork and try to implement this feature. You may guide me from
where I should start to examine zato source code…
Thanks, the thing is first to find out how to tell the requests package
to use a proxy or not in a given call.
The invoke_http method here …
https://github.com/zatosource/zato/blob/master/code/zato-server/src/zato/=
server/connection/http_soap/outgoing.py#L70
As you can see, the method accepts both *args and **kwargs.
These are the same *args and **kwargs you use in an outgoing connection
call, for instance:
conn =3D self.outgoing.plain_http[‘My Conn’].conn
conn.post(self.cid, ‘data’, some_arg=3D’value’)
Now this some_arg is passed to requests 1:1 through **kwargs above.
So if there is any way to signal through an argument that requests use
or not an HTTP proxy, you can just provide it in your call in the
outgoing connection.
I’m not sure if there is one, you can check its docs + source code.
Other than that, the *_PROXY variables are read from os.environ so if
the above doesn’t work we may need to set a required proxy in os.environ
right before a call and unset it right after it somehow taking into
account the fact that it’s a per-process variable, i.e. all HTTP calls
within a Zato server share the same os.environ dictionary.