MCPcopy Create free account
hub / github.com/Boris-code/feapder / quick_to_json

Function quick_to_json

feapder/utils/tools.py:2306–2331  ·  view source on GitHub ↗

@summary: 可快速将浏览器上的header转为json格式 --------- @param text: --------- @result:

(text)

Source from the content-addressed store, hash-verified

2304
2305
2306def quick_to_json(text):
2307 """
2308 @summary: 可快速将浏览器上的header转为json格式
2309 ---------
2310 @param text:
2311 ---------
2312 @result:
2313 """
2314
2315 contents = text.split("\n")
2316 json = {}
2317 for content in contents:
2318 if content == "\n":
2319 continue
2320
2321 content = content.strip()
2322 regex = ["(:?.*?):(.*)", "(.*?):? +(.*)", "([^:]*)"]
2323
2324 result = get_info(content, regex)
2325 result = result[0] if isinstance(result[0], tuple) else result
2326 try:
2327 json[result[0]] = eval(result[1].strip())
2328 except:
2329 json[result[0]] = result[1].strip()
2330
2331 return json
2332
2333
2334##############################

Callers

nothing calls this directly

Calls 1

get_infoFunction · 0.85

Tested by

no test coverage detected