MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / parse_extra_headers

Function parse_extra_headers

internbootcamp/utils/run_evaluation.py:78–94  ·  view source on GitHub ↗

解析额外的HTTP头部参数 Args: headers_str: 格式如 "key1:value1,key2:value2" 的字符串 Returns: 解析后的头部字典

(headers_str: str)

Source from the content-addressed store, hash-verified

76
77
78def parse_extra_headers(headers_str: str) -> Dict[str, str]:
79 """
80 解析额外的HTTP头部参数
81
82 Args:
83 headers_str: 格式如 "key1:value1,key2:value2" 的字符串
84
85 Returns:
86 解析后的头部字典
87 """
88 headers = {}
89 if headers_str:
90 for header in headers_str.split(','):
91 if ':' in header:
92 key, value = header.split(':', 1)
93 headers[key.strip()] = value.strip()
94 return headers
95
96
97def parse_extra_params(params_str: str) -> Dict[str, any]:

Callers 1

mainFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected