aristanetworks/cvprac

Add the ability to pass proxies to cvprac

rbtucker3rd opened this issue · 2 comments

Need the ability to pass proxies when using cvprac to connect to CVaaS from a corporate network.

Was able to get it to work by adding the following lines right after line 381d in cvp_client.py:

self.session.proxies={
'https': 'hostname.domain.com:8080',
'http': 'hostname.domain.com:8080'
}

Here is the link in the code where I added the proxies (after this line):

self.session = requests.Session()

Hi @rbtucker3rd

There are two options here. One is to apply the proxies to the overall session like the example you have provided. The other is to apply the proxies to the individual requests. The difference is with precedence of the proxy related environment variables. Documentation here. I am going to go with your initial suggestion of applying the proxies to the session unless there are specific reasons for applying them to the individual requests.

I can't think of a reason for my use case to apply the proxies to an individual request. I think applying it to the session makes the most sense.