发送PATCH请求 :param endpoint: API接口的具体路径 :param data: PATCH请求的表单数据 :param json: PATCH请求的JSON数据 :return: 返回请求的响应
(self, endpoint, data=None, json=None)
| 84 | return None |
| 85 | |
| 86 | def patch(self, endpoint, data=None, json=None): |
| 87 | """ |
| 88 | 发送PATCH请求 |
| 89 | :param endpoint: API接口的具体路径 |
| 90 | :param data: PATCH请求的表单数据 |
| 91 | :param json: PATCH请求的JSON数据 |
| 92 | :return: 返回请求的响应 |
| 93 | """ |
| 94 | url = f"{self.base_url}/{endpoint}" |
| 95 | |
| 96 | try: |
| 97 | response = requests.patch( |
| 98 | url, |
| 99 | headers=self._build_headers(), |
| 100 | data=data, |
| 101 | json=json, |
| 102 | timeout=self.timeout, |
| 103 | ) |
| 104 | return self._handle_response(response) |
| 105 | except Timeout: |
| 106 | print("请求超时") |
| 107 | return None |
| 108 | |
| 109 | def delete(self, endpoint): |
| 110 | """DELETE 请求""" |
no test coverage detected