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

Method upload_file

client/util/api/fileserver.py:91–104  ·  view source on GitHub ↗

上传文件到文件服务器 :param filepath: 要上传的文件路径 :param rel_url: 上传到服务器的相对url :return: 上传到服务器后的完整url, 如果上传失败, 返回 None

(self, filepath, rel_url)

Source from the content-addressed store, hash-verified

89 return file_url
90
91 def upload_file(self, filepath, rel_url):
92 """
93 上传文件到文件服务器
94 :param filepath: 要上传的文件路径
95 :param rel_url: 上传到服务器的相对url
96 :return: 上传到服务器后的完整url, 如果上传失败, 返回 None
97 """
98 with open(filepath, 'rb') as fp:
99 headers = {
100 "Content-SHA256": FlieHash.get_sha256(filepath),
101 "Content-MD5": FlieHash.get_md5(filepath)
102 }
103 headers.update(self._headers)
104 return self.__upload_data(fp, rel_url, headers)
105
106 def load_data(self, rel_url):
107 """

Callers

nothing calls this directly

Calls 4

__upload_dataMethod · 0.95
get_sha256Method · 0.80
get_md5Method · 0.80
updateMethod · 0.45

Tested by

no test coverage detected