上传文件到文件服务器 :param filepath: 要上传的文件路径 :param rel_url: 上传到服务器的相对url :return: 上传到服务器后的完整url, 如果上传失败, 返回 None
(self, filepath, rel_url)
| 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 | """ |
nothing calls this directly
no test coverage detected