@
securityCoding 我不太了解这个,看他的代码是基于 POST 发送的……。
```python
def _request(
self,
method: RpcMethod,
arguments: Optional[Dict[str, Any]] = None,
ids: Optional[_TorrentIDs] = None,
require_ids: bool = False,
timeout: Optional[_Timeout] = None,
) -> dict:
"""
Send json-rpc request to Transmission using http POST
"""
if not isinstance(method, str):
raise ValueError("request takes method as string")
if arguments is None:
arguments = {}
if not isinstance(arguments, dict):
raise ValueError("request takes arguments as dict")
ids = _parse_torrent_ids(ids)
if len(ids) > 0:
arguments["ids"] = ids
elif require_ids:
raise ValueError("request require ids")
query = {"tag": self._sequence, "method": method, "arguments": arguments}
self._sequence += 1
start = time.time()
http_data = self._http_query(query, timeout)
elapsed = time.time() - start
self.logger.info("http request took %.3f s", elapsed)
```