$ export https_proxy=https://用户名:密码@代理地址:代理端口
如果直接输入 BASH 会报错: bash: !@172.16.2.17: 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:%s@172.10.22.17:8787" % (user,passwd)
print URL
$ export HTTP_PROXY=http://CodeCore:%40MingHou233%21@172.16.2.17:8780
$ export HTTPS_PROXY=https://CodeCore:%40MingHou233%21@172.16.2.17:8780
#cmd = {\\\"HTTPS_PROXY\\\":\\\"https:\\/\\/aaa:fdgdg@12.12.12.13:80\\\",\\\"HTTP_PROXY\\\":\\\"http:\\/\\/saad:bbb@12.12.122.13:1133\\\"}
{"PROXYCONF":{
"proxy_switch":"yes",
"type":"https",
"ip":"192.168.1.200",
"port":443,
"verify_passwd":"yes",
"user":"admin",
"password":"ad@123*123"
}