?#定義代碼格式
#-*-?coding:utf8?-*-
from?urllib?import?request
from?urllib?import?parse
from?urllib.request?import?urlopen
url?=?"http://reg.haibian.com/login/ajax_login"
#定義請求數據并賦值
data?=?{}
data['loginname']?=?'[email protected]'
data['password']?=?'111111'#密碼應該是MD5的,在百度翻譯,這里不知道為什么明文就可以通過
data?=?parse.urlencode(data)
#將數據和url進行連接
requests?=?url+'?'+data
#打開請求獲取對象
requestResponse?=?urlopen(requests)
#讀取服務端返回的對象
responseStr?=?requestResponse.read()
#打印數據
#ResponseStr?=?responseStr.decode("unicode_escape")???#將密碼進行轉譯(因為密碼用的是MD5的,對應上邊)
print(responseStr)
2019-05-22
第10行密碼沒有加密成MD5就可以通過應該是URL改成了明文
19行這個不是密碼轉譯,是URL返回的json數據是unicode_escape格式的編碼,采用decode將它反義成我們能看的string類型的字符串