This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_user_psw(auth): | |
from urllib import quote | |
returned = '' | |
if auth: | |
# urllib.quote 转义 @:/ 等特殊字符 | |
# 第二个参数表示转义任何字符,默认会不转义 / 字符 | |
user = quote(auth['username'], '') | |
psw = quote(auth['password'], '') | |
returned = '%s:%s@' % (user, psw) | |
return returned |
NewerOlder