mirror of
https://github.com/simon987/ws_bucket_client.git
synced 2025-04-10 13:56:43 +00:00
Update api
This commit is contained in:
parent
03a21d28a8
commit
2cd3d217a7
6
api.py
6
api.py
@ -19,11 +19,13 @@ class WsBucketApi:
|
|||||||
self._secret = secret.encode("utf8")
|
self._secret = secret.encode("utf8")
|
||||||
self._ws_scheme = ws_scheme
|
self._ws_scheme = ws_scheme
|
||||||
|
|
||||||
def allocate(self, token: str, max_size: int, file_name: str):
|
def allocate(self, token: str, max_size: int, file_name: str, upload_hook: str, to_dispose_date: int):
|
||||||
return self._http_post("/slot", {
|
return self._http_post("/slot", {
|
||||||
"token": token,
|
"token": token,
|
||||||
"max_size": max_size,
|
"max_size": max_size,
|
||||||
"file_name": file_name,
|
"file_name": file_name,
|
||||||
|
"upload_hook": upload_hook,
|
||||||
|
"to_dispose_date": to_dispose_date,
|
||||||
})
|
})
|
||||||
|
|
||||||
def read(self, token: str):
|
def read(self, token: str):
|
||||||
@ -31,7 +33,7 @@ class WsBucketApi:
|
|||||||
|
|
||||||
def upload(self, token: str, stream: BinaryIO, max_size: int):
|
def upload(self, token: str, stream: BinaryIO, max_size: int):
|
||||||
ws = websocket.WebSocket()
|
ws = websocket.WebSocket()
|
||||||
ws.connect(self._ws_scheme + "://" + self._url + "/upload", header={
|
ws.connect(self._ws_scheme + "://" + self._url.netloc + "/upload", header={
|
||||||
"X-Upload-Token": token,
|
"X-Upload-Token": token,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user