linux http代理设置
$ export https_proxy=https://用户名:密码@代理地址:代理端口
如果直接输入 BASH 会报错: bash: [email protected]: event not found
解决办法 就是将特殊字符转换成 ASIIC 码形式输入, 以 % + Hex 形式(0x忽略).
参考链接: ASCII Reference
比如常见的会出现在密码中的特殊字符:
~ : 0x7E, ! : 0x21
@ : 0x40, # : 0x23
$ : 0x24, % : 0x25
^ : 0x5E, & : 0x26
* : 0x2A, ? : 0x3F
poet_name = "hp123!@#"
>>> url_code_name = urllib.quote(poet_name)
>>> print url_code_name
hp123%21%40%23
import urllib
user="李白"
user = urllib.quote(user)
passwd="hp123!@#"
passwd = urllib.quote(passwd)
URL = "http://%s:%[email protected]:8787" % (user,passwd)
print URL
$ export HTTP_PROXY=http://CodeCore:%40MingHou233%[email protected]:8780
$ export HTTPS_PROXY=https://CodeCore:%40MingHou233%[email protected]:8780
#cmd = {\\\"HTTPS_PROXY\\\":\\\"https:\\/\\/aaa:[email protected]:80\\\",\\\"HTTP_PROXY\\\":\\\"http:\\/\\/saad:[email protected]:1133\\\"}
{"PROXYCONF":{
"proxy_switch":"yes",
"type":"https",
"ip":"192.168.1.200",
"port":443,
"verify_passwd":"yes",
"user":"admin",
"password":"ad@123*123"
}