When converting curl to python language

Viewed 47

I copied the curl data through an act like this:

enter image description here

I want to convert the below curl to python language. But The data in the form of a dictionary inside curl is wrapped in a strange form.**

The strange form of data looks like this:

--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^\^"^}^}"

I want to convert the data into a dictionary that can be processed in python.

I wonder why the data is in such an unusual form. Can you tell me how to transform the data into a normal form?

1 Answers

The weirdness is almost certainly because cmd has unusual rules with regards to escaping characters. If you copy the bash variety of Curl command, it'll look nicer.

It'll also work in Curl-to-Python converters such as this one.

Related