From a6d8e78ed0b745e44b42415a42e45f13a1a4bdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20J=C3=A4ger?= Date: Mon, 26 Jun 2023 20:25:57 +0000 Subject: [PATCH] feat(dependencies): update httpx to 0.21.3 This update makes it possible to use httpx for fastapi testing in our project. The older version used here was not compatible. --- lumapps/api/base_client.py | 8 ++++++-- pyproject.toml | 4 ++-- tests/legacy/test_base_client.py | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lumapps/api/base_client.py b/lumapps/api/base_client.py index ceea03ed..190adbd4 100644 --- a/lumapps/api/base_client.py +++ b/lumapps/api/base_client.py @@ -36,7 +36,7 @@ LUMAPPS_VERSION = "v1" LUMAPPS_NAME = "lumsites" LUMAPPS_BASE_URL = "https://lumsites.appspot.com" -FileContent = Union[IO[str], IO[bytes], str, bytes] +FileContent = Union[IO[bytes], bytes] class BaseClient(AbstractContextManager): @@ -386,7 +386,11 @@ def upload(self, file_content: FileContent, metadata: dict, *name_parts, **param path: Any = self.discovery_doc["rootUrl"].rstrip("/") + upload_specs["path"] # type: ignore # noqa path = self._expand_path(path, endpoint, params) files = { - "data": ("metadata", dumps(metadata), "application/json; charset=UTF-8"), + "data": ( + "metadata", + bytes(dumps(metadata), "utf-8"), + "application/json; charset=UTF-8", + ), "file": file_content, } resp = self.client.request(verb, path, params=params, files=files) diff --git a/pyproject.toml b/pyproject.toml index e2c8451f..afeea744 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ include = [ python = ">=3.7,<4.0" Authlib = "<=0.15.3" python-slugify = "^4.0.1" -httpx = "^0.15.5" +httpx = "^0.21.3" PyJWT = "^2.1.0" pre-commit = "^2.13.0" requests-oauthlib = "^1.3.0" @@ -43,7 +43,7 @@ black = "22.3.0" isort = { version = "^4.3", extras = ["pyproject"] } safety = "^1.9.0" pytest-cov = "^2.9.0" -pytest-httpx = "^0.9.0" +pytest-httpx = "^0.15.0" requests-mock = "^1.9.3" livereload = "^2.6.3" vcrpy = "^4.1.1" diff --git a/tests/legacy/test_base_client.py b/tests/legacy/test_base_client.py index 0b7ae925..97ae839d 100644 --- a/tests/legacy/test_base_client.py +++ b/tests/legacy/test_base_client.py @@ -328,7 +328,7 @@ def test_with_proxy_1(): proxy_info={"scheme": "http", "host": "foo.bar.com", "port": 12345}, ) s = c.client - assert len(s._proxies) == 2 + assert len(s._mounts) == 2 def test_with_proxy_2(): @@ -343,7 +343,7 @@ def test_with_proxy_2(): }, ) s = c.client - assert len(s._proxies) == 2 + assert len(s._mounts) == 2 def test_discovery_doc(mocker):