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 ea0c175
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
run: ulimit -a

- name: Build docker
run: docker-compose -f docker/docker-compose.yml build --build-arg BASE_IMG=python:${{ matrix.python-version }} --no-cache
run: docker compose -f docker/docker-compose.yml build --build-arg BASE_IMG=python:${{ matrix.python-version }} --no-cache

- name: Run unit tests
run: docker-compose -f docker/docker-compose.yml run --rm unit-test
run: docker compose -f docker/docker-compose.yml run --rm unit-test

- name: Run integration tests
run: docker-compose -f docker/docker-compose.yml run --rm integration-test
run: docker compose -f docker/docker-compose.yml run --rm integration-test

- name: Generate coverage html report with dynamic contexts
run: docker-compose -f docker/docker-compose.yml run --rm coverage
run: docker compose -f docker/docker-compose.yml run --rm coverage

- uses: actions/upload-artifact@v3
with:
Expand Down
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 ea0c175

Please sign in to comment.