import json
variable = """
POST https://gw.app.com/v2/cart/calculation HTTP/1.1
lat:
lng:
language: ch
deviceid: 48f4a774-2b87-346c-8765-ae6daa9321d3
IsInPark: 0
OS: Android
PreSaleSign: 0
{
"coupon": [],
"sale_channel": "App",
"ticket": [
{
"facility_image": "",
"guest_age": "",
"ticket_type": "1-Day",
"ticket_type_id": "61a963fd4c473014cf193013",
"visit_end_time": "2024年06月06日",
"visit_start_time": "2024年06月06日"
}
]
}
"""
data = variable.split('\n\n')
for i in data[0].split('\n'):
if i:
if 'GET' in i or 'POST' in i:
i = i.replace(' ', '')
url = i.replace('GET', "curl '").replace('POST', "curl '").replace('HTTP/1.1', "'\\")
print(url)
else:
curl2 = f" -H '{i}'\\"
print(curl2)
data2 = data[1]
curl2 = f" --data-raw '{data2}'\\"
print(curl2+'\n'+' --compressed')
一键把fiddler请求信息转化为curl
于 2024-06-03 18:13:44 首次发布