Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lumapps/api/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy/test_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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):
Expand Down