We do this by shoving it into Rust. We believe our python http client is a bit slow. Also bumps minimum rust version to 1.81.0, released last September (over six months ago) To allow for async Rust, includes some adapters between Tokio in Rust and the Twisted reactor in Python.
25 lines
844 B
Python
25 lines
844 B
Python
# This file is licensed under the Affero General Public License (AGPL) version 3.
|
|
#
|
|
# Copyright (C) 2025 New Vector, Ltd
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# See the GNU Affero General Public License for more details:
|
|
# <https://www.gnu.org/licenses/agpl-3.0.html>.
|
|
|
|
from typing import Awaitable, Mapping
|
|
|
|
class HttpClient:
|
|
def __init__(self, user_agent: str) -> None: ...
|
|
def get(self, url: str, response_limit: int) -> Awaitable[bytes]: ...
|
|
def post(
|
|
self,
|
|
url: str,
|
|
response_limit: int,
|
|
headers: Mapping[str, str],
|
|
request_body: str,
|
|
) -> Awaitable[bytes]: ...
|