簡體   English   中英

將 curl 轉換為 python 語言時

[英]When converting curl to python language

我通過這樣的行為復制了 curl 數據:

在此處輸入圖像描述

我想將下面的 curl 轉換為 python 語言。 但是 curl 內部的字典形式的數據被包裹在一種奇怪的形式中。**

奇怪的數據形式如下:

--data-raw "^{^\^"common^\^":^{^\^"platform^\^":^\^"web^\^",^\^"pcid^\^":^\^"16185750214525097140297^\^",^\^"memberSrl^\^":^\^"^\^",^\^"libraryVersion^\^":^\^"1.3.0^\^",^\^"lang^\^":^\^"ko-KR^\^",^\^"resolution^\^":^\^"1536x864^\^",^\^"eventTime^\^":^\^"2021-05-12T05:40:15.119Z^\^",^\^"web^\^":^{^\^"pvid^\^":^\^"47b25d6b-2f7f-4edd-954e-6afb0413400e^\^",^\^"rvid^\^":^\^"^\^",^\^"url^\^":^\^"https://www.coupang.com/vp/products/281480779?vendorItemId=5246745661&sourceType=SDP_ALSO_VIEWED&rmdId=ed1666c1f69045658605a47bd3500ad9&eventLabel=recommendation_widget_pc_sdp_001&platform=web&rmdABTestInfo=10803:B,8534:A,12823:A,8088:A,8091:A,12574:C&rmdValue=p5269107492:vt-1.0.0:p281480779^\^",^\^"referrer^\^":^\^"https://www.coupang.com/vp/products/5269107492?itemId=7504683294&vendorItemId=74795528373&isAddedCart=^\^"^}^},^\^"meta^\^":^{^\^"schemaId^\^":238,^\^"schemaVersion^\^":27^},^\^"data^\^":^{^\^"productId^\^":281480779,^\^"vendorItemId^\^":5246745661,^\^"itemId^\^":893525515,^\^"sdpVisitKey^\^":^\^"tzygb7zra2s1johxcn^\^",^\^"domain^\^":^\^"sdp^\^",^\^"pageName^\^":^\^"recommendation^\^",^\^"eventName^\^":^\^"sdp_bottom_ads^\^",^\^"rmdValue^\^":^\^"p281480779:sdp_bottom_ads-1.0.0:p3443790,p281480779:sdp_bottom_ads-1.0.0:p1463163,p281480779:sdp_bottom_ads-1.0.0:p1413317797,p281480779:sdp_bottom_ads-1.0.0:p4753927275,p281480779:sdp_bottom_ads-1.0.0:p295539532,p281480779:sdp_bottom_ads-1.0.0:p1947426099,p281480779:sdp_bottom_ads-1.0.0:p1920685625,p281480779:sdp_bottom_ads-1.0.0:p1919127654,p281480779:sdp_bottom_ads-1.0.0:p1406557439,p281480779:sdp_bottom_ads-1.0.0:p4348160225,p281480779:sdp_bottom_ads-1.0.0:p1919127636,p281480779:sdp_bottom_ads-1.0.0:p324721177,p281480779:sdp_bottom_ads-1.0.0:p1661152176,p281480779:sdp_bottom_ads-1.0.0:p2207652674,p281480779:sdp_bottom_ads-1.0.0:p1318104835,p281480779:sdp_bottom_ads-1.0.0:p4541415097,p281480779:sdp_bottom_ads-1.0.0:p6120321,p281480779:sdp_bottom_ads-1.0.0:p200766309,p281480779:sdp_bottom_ads-1.0.0:p5301593450,p281480779:sdp_bottom_ads-1.0.0:p87794416^\^",^\^"feedsId^\^":^\^"02e6ae196d5b45bf93004ff3222a231d^\^",^\^"logType^\^":^\^"impression^\^",^\^"logCategory^\^":^\^"impression^\^"^},^\^"extra^\^":^{^\^"sentTime^\^":^\^"2021-05-12T05:40:15.119Z^\^"^},^\^"campaign^\^":^{^\^"src^\^":^\^"1042016^\^",^\^"spec^\^":^\^"10304903^\^",^\^"sid^\^":^\^"^\^",^\^"lptag^\^":^\^"^쿠^팡^\^",^\^"itime^\^":^\^"20210512143934^\^",^\^"ctag^\^":^\^"HOME^\^",^\^"appver^\^":^\^"^\^",^\^"addtag^\^":^\^"900^\^"^}^}"

我想將數據轉換成可以在python中處理的字典。

我想知道為什么數據的形式如此不尋常。 您能告訴我如何將數據轉換為正常形式嗎?

奇怪的是幾乎可以肯定是因為cmd對 escaping 字符有不尋常的規則。 如果你復制bash各種 Curl 命令,它看起來會更好。

它也適用於 Curl-to-Python 轉換器,例如這個.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM