user_agents = [ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36' ]
import requests import base64 import random from user_agents import user_agents import os import time #定义打开图片功能 def open_qrcode(): if os.path.isfile('qrcode.png'): if os.name == 'nt': os.system('start qrcode.png') else: raise FileNotFoundError class migu_session(object): def __init__(self): self.session = requests.Session() self.user_agent = random.choice(user_agents) def get_qrcode_and_login(self): url = 'https://passport.migu.cn/api/qrcWeb/qrcLogin' url_auth_login = 'https://passport.migu.cn/api/qrcWeb/qrcquery' headers = { 'user_agent':self.user_agent, 'host': 'passport.migu.cn' } payload = {