aelbouha
aelbouha

Reputation: 11

Configure proxy with python

I am looking to use a public API running on a distant server from within my company. For security reasons, I am supposed to redirect all the traffic via the company's PROXY. Does anyone know how to do this in Python?

Upvotes: 0

Views: 5143

Answers (2)

Simon Delecourt
Simon Delecourt

Reputation: 1599

Directly in python you can do :

os.environ["HTTP_PROXY"] = http://proxy.host.com:8080.

Or as it has been mentioned before launching by @hardillb on a terminal :

export HTTP_PROXY=http://proxy.host.com:8080

Upvotes: 3

hardillb
hardillb

Reputation: 59628

Set the HTTP_PROXY environment variable before starting your python script

e.g. export HTTP_PROXY=http://proxy.host.com:8080

Upvotes: 1

Related Questions