在提琴手,我捕獲與來自客戶端發送的以下cookie字符串(在檢查員可見>原)的HTTPS請求:轉換cookie字符串成Python字典
Cookie: devicePixelRatio=1; ident=exists; __utma=13103r6942.2918; __utmc=13103656942; __utmz=13105942.1.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); mp_3cb27825a6612988r46d00tinct_id%22%3A%201752338%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.pion_created_at%22%3A%20%222015-08-03%22%2C%22platform%22%3A%20%22web%22%2C%%22%3A%20%%22%7D; t_session=BAh7DUkiD3Nlc3NpbWVfZV9uYW1lBjsARkkiH1BhY2lmaWMgVGltZSAoVVMgJiBDYW5hZGEpBjsAVEkiFXNpZ25pbl9wZXJzb25faWQGOwBGaQMSvRpJIhRsYXN0X2xvZ2luX2RhdGUGOwBGVTogQWN0aXZlU3VwcG9ydDo6VGltZVdpdGhab25lWwhJdToJVGltZQ2T3RzAAABA7QY6CXpvbmVJIghVVEMGOwBUSSIfUGFjaWZpZWRfZGFzaGJvYXJkX21lc3NhZ2UGOwBGVA%3D%3D--6ce6ef4bd6bc1a469164b6740e7571c754b31cca
我想在使用這個cookie一個Python請求請求。 (我稍微修改了這個cookie,這樣它就不會被讀者用於惡意目的!)。
但是,請求似乎使用dictionary format for sending cookies,我無法將上述字符串/ blob轉換爲字典格式。
我的問題是:
- 是否有一個字符串轉換自動化的方式(就像我在小提琴手捕獲的cookie中)到在Python字典?
在上述的cookie,什麼是'mp_3cb27825a6612988r46d00tinct_id%22%3A%201752338%2C%22%24initial_referrer%22%3A%20%22https%3A %2F%2Fwww.pion_created_at%22%3A%20%222015-08-03%22%2C%22platform%22%3A%20%22web%22%2C %% 22%3A%20 %% 22%7D; ',爲什麼它不遵循key = value格式? – zyxue
不確定。我只是複製了OP提供的內容。 – rcoyner
當你使用Cookie模塊時,該部分似乎被丟棄,使我想知道cookie的格式... – zyxue