Skip to content

Commit 906deed

Browse files
authored
Fix upload (#16)
* Fix upload * Fix lint
1 parent 6b821cc commit 906deed

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

edge_addons_api/client.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,15 @@ def _publish(self, notes: str, access_token: str) -> str:
6868
return response.headers["Location"]
6969

7070
def _upload(self, file_path: str, access_token: str) -> str:
71-
72-
files = {"file": open(file_path, "rb")}
73-
74-
response = requests.post(
75-
self._upload_endpoint(),
76-
files=files,
77-
headers={
78-
"Authorization": f"Bearer {access_token}",
79-
"Content-Type": "application/zip",
80-
},
81-
)
71+
with open(file_path, "rb") as f:
72+
response = requests.post(
73+
self._upload_endpoint(),
74+
data=f,
75+
headers={
76+
"Authorization": f"Bearer {access_token}",
77+
"Content-Type": "application/zip",
78+
},
79+
)
8280

8381
response.raise_for_status()
8482

0 commit comments

Comments
 (0)