import uuid
import requests
import json
class Mogu():
def wakaka(self):
self.headers = {'Content-Type': 'application/json; charset=UTF-8'}
self.payload = {
'loginType': "iphone",
'password': "Jia25257758",
'phone': "18082539819",
}
self.session = requests.session()
def get_login(self):
url = "https://api.moguding.net:9000/session/user/v1/login"
print("self.payload",self.payload)
#把字典 self.payload 改成 字符串并且encode成默认的加密格式
test_data = json.dumps(self.payload).encode()
response = self.session.post(url,headers=self.headers,data=test_data)
print("状态", response.status_code)
print("登陆以后返回的html",response.text)
def split_captcha(self):
self.uu = uuid.uuid4()
print("self.uu",self.uu,type(self.uu))
self.payload["uuid"] = str(self.uu)
print("---------------------------------",self.payload)
captcha_url = "https://api.moguding.net:9000/session/user/v1/captcha.jpg?uuid={}".format(str(self.uu))
return captcha_url
if __name__ == '__main__':
mo = Mogu()
mo.wakaka()
mo.get_login()