Skip to content

Commit

Permalink
Only use http1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro committed Aug 21, 2024
1 parent 61f93a6 commit 9aed057
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
4 changes: 2 additions & 2 deletions fauna/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def __init__(
from fauna.http.httpx_client import HTTPXClient
c = HTTPXClient(
httpx.Client(
http1=False,
http2=True,
http1=True,
http2=False,
timeout=httpx.Timeout(
timeout=timeout_s,
connect=connect_timeout_s,
Expand Down
25 changes: 5 additions & 20 deletions fauna/http/httpx_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,12 @@ def request(
raise ClientError("Invalid URL Format") from e

try:
return HTTPXResponse(self._send_with_retry(3, request))
except (httpx.HTTPError, httpx.InvalidURL) as e:
raise NetworkError("Exception re-raised from HTTP request") from e

def _send_with_retry(
self,
retryCount: int,
request: httpx.Request,
) -> httpx.Response:
try:
response = self._c.send(
return HTTPXResponse(self._c.send(
request,
stream=False,
)
return response
except httpx.TransportError as e:
if retryCount == 0:
raise e
else:
return self._send_with_retry(retryCount - 1, request)
))
except (httpx.HTTPError, httpx.InvalidURL) as e:
raise NetworkError("Exception re-raised from HTTP request") from e

@contextmanager
def stream(
Expand All @@ -101,8 +87,7 @@ def stream(
headers: Mapping[str, str],
data: Mapping[str, Any],
) -> Iterator[Any]:
with self._c.stream(
"POST", url=url, headers=headers, json=data) as response:
with self._c.stream("POST", url=url, headers=headers, json=data) as response:
yield self._transform(response)

def _transform(self, response):
Expand Down

0 comments on commit 9aed057

Please sign in to comment.