import requests def getToken(): body = { 'username': 'fan@yunying.com', 'password': 'm%Bn$w5jgiNsNC' } res = requests.post('http://192.168.124.12:4533/music/auth/login', json = body) resJson = res.json() return resJson.get('token')