Поиск по блогу

четверг, 28 августа 2014 г.

Здесь советы по использованию переменной окружения HTTP_PROXY (HTTPS_PROXY)

Загнать всех в цепочку прокси можно переменной окружения HTTP_PROXY (HTTPS_PROXY) Из консоли выполняем в windows - set, в Linux - export... Но значит ли это, что все TCP/IP соединения начнут использовать прокси автоматически? Выходит, что таки да. Есть даже переменная "no_proxy" Но я, однако, сомневаюсь... но проще попробовать, чем искать ответ в сети... Не забыть опубликовать ответ в комментариях.
In []:
#Set the HTTP_PROXY environment variable using the command specific to your shell. For example, in bash, use the export command.
export HTTP_PROXY=http://my.proxyserver.com:8080
In []:
#To make this change persistent, add the command to the appropriate profile file for the shell. 
#For example, in bash, add a line like the following to your .bash_profile or .bashrc file:linux       
http_proxy=http://username:password@hostname:port;
export $HTTP_PROXY

In Windows

In [6]:
from IPython.display import Image
In [11]:
Image(url='http://docs.pivotal.io/pivotalcf/devguide/images/proxy/new.png')
Out[11]:
In [12]:
Image(url='http://docs.pivotal.io/pivotalcf/devguide/images/proxy/proxy.png')
Out[12]:
Или в окне консоли
In []:
# example
SET http_proxy=http://someproxy.com:3128
In []:
#Set up environment variable http_proxy / https_proxy to http://your-proxy-server-address:proxy-port

#The urlopen() function works transparently with proxies which do not require authentication. 
#In a Unix or Windows environment, set the http_proxy, or ftp_proxy environment variables to 
#a URL that identifies the proxy server before starting the Python interpreter. 
#For example (the '%' is the command prompt):

% http_proxy="http://www.someproxy.com:3128"
% export http_proxy
% python
...
The no_proxy environment variable can be used to specify hosts which shouldn’t be reached via proxy; if set, it should be a comma-separated list of hostname suffixes, optionally with :port appended,
In []:
#for example 
cern.ch,ncsa.uiuc.edu,some.host:8080.


Посты чуть ниже также могут вас заинтересовать

Комментариев нет:

Отправить комментарий