MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / session

Method session

server/projects/analysis/util/httpclient.py:29–40  ·  view source on GitHub ↗

请求基础方法

(self, method, path, params, data=None, json_data=None, headers=None, **kwargs)

Source from the content-addressed store, hash-verified

27 self._http_client = poolmanager.PoolManager(retries=_retries)
28
29 def session(self, method, path, params, data=None, json_data=None, headers=None, **kwargs):
30 """请求基础方法
31 """
32 if data and type(data) != bytes:
33 data = str(data).encode("utf-8")
34 elif json_data:
35 data = json.dumps(json_data).encode("utf-8")
36 if kwargs.get("stream") is True:
37 return self._http_client.request(method, path, fields=params, headers=headers, preload_content=False)
38
39 else:
40 return self._http_client.request(method, path, fields=params, headers=headers, body=data, **kwargs)
41
42 def get(self, path, params=None, headers=None, **kwargs):
43 result = self.session("GET", path, params=params, headers=headers, **kwargs)

Callers 5

getMethod · 0.95
postMethod · 0.95
putMethod · 0.95
patchMethod · 0.95
deleteMethod · 0.95

Calls 2

requestMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected