strs=''' content-type: application/x-www-form-urlencoded cookie: _iuqxldmzr_=32; _ntes_nnid=cb19ce2c34b69416ecbc14b408135460,1552790636492; _ntes_nuid=cb19ce2c34b69416ecbc14b408135460; WM_TID=SaK%2F0APMDZNFERABVUY8g8TC1JG0uMnX; JSESSIONID-WYYY=wWJCh%5CPCwCiC2NAw%5CY1hRYfUVetiDrYuzX5dbU8wubkzrowYl%5C3z%2FoOiIqbmWn3El%2Fzna7WCD%2BuylihabpSnXghsOli62vhRNeKmTWNs5TwRyxthmpED1UR32j8%2F0M8tYQ2NJo11N533Hu9uU17ov05P9y6N7gHWev7yYQ00UDhS6qPI%3A1557235777412; WM_NI=9pUW0to5KVtrdu9a28u6eZMAvkLE0nBYZuRno7mWyQaHV8MfbvR8rh4vpZ1AOXApJPjXHA%2B%2B50ISN7ucK4SHWJ6fIboQ3KzVAgkIOQbHS1AzkSmYuWGslZIVJTm8Jl3fTFA%3D; WM_NIKE=9ca17ae2e6ffcda170e2e6ee8bc172bb97bbb9c1728aa88ab6c55a878a8baaf3628f9797b1d544aa958eb3d32af0fea7c3b92afbb09bb8b380adeb85b7f77aa8abf782b134b7eaabbbd04bb6b584a6b36682879696d166ade9a3b8fc5ba3989ad9d06ea2aa9ed9f164f8aac0bbb44b8d888f91c95caa8888a2aa21f7f087b4cd3db7bd85d5d2449596fa87cc6aad8ffdacf95e83b9a5aace5ba2989dd2c472a98da3baf85d85ada4bbcc5e8a8ca3d9c968f1ba9ca7c437e2a3; playerid=99500353 origin: https://music.163.com referer: https://music.163.com/ user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36 ''' def gen_headers(self,s): ls = s.split(' ') lsl = [] ls = ls[1:-1] headers = {} for l in ls: l = l.split(': ') lsl.append(l) for x in lsl: headers[str(x[0]).strip(' ')] = x[1] return headers