dxpos-openapi 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dxpos_openapi-0.0.2/src/dxpos_openapi.egg-info → dxpos_openapi-0.0.3}/PKG-INFO +34 -5
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/README.md +33 -4
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/pyproject.toml +1 -1
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi/__init__.py +1 -1
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi/client.py +29 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi/constants.py +5 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3/src/dxpos_openapi.egg-info}/PKG-INFO +34 -5
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/tests/test_client.py +75 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/LICENSE +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/setup.cfg +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi/auth.py +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi.egg-info/SOURCES.txt +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi.egg-info/dependency_links.txt +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi.egg-info/requires.txt +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/src/dxpos_openapi.egg-info/top_level.txt +0 -0
- {dxpos_openapi-0.0.2 → dxpos_openapi-0.0.3}/tests/test_auth.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dxpos-openapi
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: DXPOS OpenAPI Python SDK
|
|
5
5
|
Author-email: DXPOS <support@dxpos.co>
|
|
6
6
|
License: MIT License
|
|
@@ -115,7 +115,7 @@ client = DxposClient(
|
|
|
115
115
|
|
|
116
116
|
## 方法
|
|
117
117
|
|
|
118
|
-
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
118
|
+
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement`、`create_remove_bg` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
119
119
|
|
|
120
120
|
### 新增客户标签
|
|
121
121
|
|
|
@@ -184,6 +184,35 @@ resp = client.get_task(task_id, customer_tag_id=customer_tag_id)
|
|
|
184
184
|
resp = client.cancel_task(task_id, customer_tag_id=customer_tag_id)
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
+
### 创建抠图任务
|
|
188
|
+
|
|
189
|
+
`file_id`、`image_path` 必须二选一。`keep_props` 表示是否保留道具:`0` 保留(默认),`1` 不保留只抠人像。
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# 已经 upload_file 拿到 file_id
|
|
193
|
+
resp = client.create_remove_bg(file_id=file_id, keep_props=0)
|
|
194
|
+
|
|
195
|
+
# 本地路径:自动上传再建任务
|
|
196
|
+
resp = client.create_remove_bg(
|
|
197
|
+
image_path="/path/to/portrait.jpg",
|
|
198
|
+
keep_props=1,
|
|
199
|
+
customer_tag_id=customer_tag_id,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
task_id = resp["data"]["task_id"]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 查询抠图任务
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
resp = client.get_remove_bg_task(task_id, customer_tag_id=customer_tag_id)
|
|
209
|
+
# data.status: waiting / processing / done / failed
|
|
210
|
+
# done 时 data.result.remove_bg_url 为按人像裁剪的透明底图,
|
|
211
|
+
# data.result.remove_bg_src_url 为未裁剪、与原图同尺寸的透明底图
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
抠图失败是终态,不会自动重推,本次扣的额度会自动退回。
|
|
215
|
+
|
|
187
216
|
## 维护者:发布到 PyPI
|
|
188
217
|
|
|
189
218
|
不需要把 token 写进仓库。本机配置 `~/.pypirc`,用 `__token__` 和 API token。
|
|
@@ -195,7 +224,7 @@ pip install -e ".[dev]"
|
|
|
195
224
|
pytest
|
|
196
225
|
```
|
|
197
226
|
|
|
198
|
-
|
|
227
|
+
当前版本 `0.0.3`(新增抠图任务):
|
|
199
228
|
|
|
200
229
|
```bash
|
|
201
230
|
rm -rf dist build src/*.egg-info
|
|
@@ -203,9 +232,9 @@ python -m build
|
|
|
203
232
|
twine check dist/*
|
|
204
233
|
twine upload -r testpypi dist/*
|
|
205
234
|
# 干净环境验证:
|
|
206
|
-
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.
|
|
235
|
+
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.3
|
|
207
236
|
twine upload dist/*
|
|
208
|
-
git tag v0.0.
|
|
237
|
+
git tag v0.0.3
|
|
209
238
|
git push origin main --tags
|
|
210
239
|
```
|
|
211
240
|
|
|
@@ -58,7 +58,7 @@ client = DxposClient(
|
|
|
58
58
|
|
|
59
59
|
## 方法
|
|
60
60
|
|
|
61
|
-
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
61
|
+
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement`、`create_remove_bg` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
62
62
|
|
|
63
63
|
### 新增客户标签
|
|
64
64
|
|
|
@@ -127,6 +127,35 @@ resp = client.get_task(task_id, customer_tag_id=customer_tag_id)
|
|
|
127
127
|
resp = client.cancel_task(task_id, customer_tag_id=customer_tag_id)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
### 创建抠图任务
|
|
131
|
+
|
|
132
|
+
`file_id`、`image_path` 必须二选一。`keep_props` 表示是否保留道具:`0` 保留(默认),`1` 不保留只抠人像。
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# 已经 upload_file 拿到 file_id
|
|
136
|
+
resp = client.create_remove_bg(file_id=file_id, keep_props=0)
|
|
137
|
+
|
|
138
|
+
# 本地路径:自动上传再建任务
|
|
139
|
+
resp = client.create_remove_bg(
|
|
140
|
+
image_path="/path/to/portrait.jpg",
|
|
141
|
+
keep_props=1,
|
|
142
|
+
customer_tag_id=customer_tag_id,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
task_id = resp["data"]["task_id"]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 查询抠图任务
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
resp = client.get_remove_bg_task(task_id, customer_tag_id=customer_tag_id)
|
|
152
|
+
# data.status: waiting / processing / done / failed
|
|
153
|
+
# done 时 data.result.remove_bg_url 为按人像裁剪的透明底图,
|
|
154
|
+
# data.result.remove_bg_src_url 为未裁剪、与原图同尺寸的透明底图
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
抠图失败是终态,不会自动重推,本次扣的额度会自动退回。
|
|
158
|
+
|
|
130
159
|
## 维护者:发布到 PyPI
|
|
131
160
|
|
|
132
161
|
不需要把 token 写进仓库。本机配置 `~/.pypirc`,用 `__token__` 和 API token。
|
|
@@ -138,7 +167,7 @@ pip install -e ".[dev]"
|
|
|
138
167
|
pytest
|
|
139
168
|
```
|
|
140
169
|
|
|
141
|
-
|
|
170
|
+
当前版本 `0.0.3`(新增抠图任务):
|
|
142
171
|
|
|
143
172
|
```bash
|
|
144
173
|
rm -rf dist build src/*.egg-info
|
|
@@ -146,9 +175,9 @@ python -m build
|
|
|
146
175
|
twine check dist/*
|
|
147
176
|
twine upload -r testpypi dist/*
|
|
148
177
|
# 干净环境验证:
|
|
149
|
-
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.
|
|
178
|
+
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.3
|
|
150
179
|
twine upload dist/*
|
|
151
|
-
git tag v0.0.
|
|
180
|
+
git tag v0.0.3
|
|
152
181
|
git push origin main --tags
|
|
153
182
|
```
|
|
154
183
|
|
|
@@ -12,9 +12,11 @@ from dxpos_openapi.constants import (
|
|
|
12
12
|
HEADER_CUSTOMER_TAG,
|
|
13
13
|
PATH_CUSTOMER_TAG,
|
|
14
14
|
PATH_FILE,
|
|
15
|
+
PATH_REMOVE_BG,
|
|
15
16
|
PATH_SCENE_ENHANCEMENT,
|
|
16
17
|
PATH_THEME,
|
|
17
18
|
path_cancel,
|
|
19
|
+
path_remove_bg_task,
|
|
18
20
|
path_task,
|
|
19
21
|
)
|
|
20
22
|
|
|
@@ -120,6 +122,33 @@ class DxposClient(object):
|
|
|
120
122
|
def cancel_task(self, task_id, customer_tag_id=None):
|
|
121
123
|
return self._request("POST", path_cancel(task_id), customer_tag_id=customer_tag_id)
|
|
122
124
|
|
|
125
|
+
def create_remove_bg(
|
|
126
|
+
self, file_id=None, image_path=None, keep_props=0, customer_tag_id=None
|
|
127
|
+
):
|
|
128
|
+
picked = [item for item in (file_id, image_path) if item]
|
|
129
|
+
if len(picked) != 1:
|
|
130
|
+
return _fail("file_id、image_path 必须二选一")
|
|
131
|
+
if keep_props not in (0, 1):
|
|
132
|
+
return _fail("keep_props 只能是 0(保留道具)或 1(不保留)")
|
|
133
|
+
if image_path:
|
|
134
|
+
uploaded = self.upload_file(image_path, customer_tag_id=customer_tag_id)
|
|
135
|
+
if uploaded.get("code") != 0:
|
|
136
|
+
return uploaded
|
|
137
|
+
file_id = (uploaded.get("data") or {}).get("file_id")
|
|
138
|
+
if not file_id:
|
|
139
|
+
return _fail("上传成功但缺少 file_id")
|
|
140
|
+
return self._request(
|
|
141
|
+
"POST",
|
|
142
|
+
PATH_REMOVE_BG,
|
|
143
|
+
{"file_id": file_id, "keep_props": keep_props},
|
|
144
|
+
customer_tag_id=customer_tag_id,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def get_remove_bg_task(self, task_id, customer_tag_id=None):
|
|
148
|
+
return self._request(
|
|
149
|
+
"GET", path_remove_bg_task(task_id), customer_tag_id=customer_tag_id
|
|
150
|
+
)
|
|
151
|
+
|
|
123
152
|
def _request(self, method, path, payload=None, customer_tag_id=None):
|
|
124
153
|
body = b"" if payload is None else _encode_json(payload)
|
|
125
154
|
headers = sign_headers(self.access_key, self.secret_key, method, path, body)
|
|
@@ -3,6 +3,7 @@ DEFAULT_BASE_URL = "https://openapi.dxpos.co"
|
|
|
3
3
|
PATH_THEME = "/api/v1/theme"
|
|
4
4
|
PATH_FILE = "/api/v1/file"
|
|
5
5
|
PATH_SCENE_ENHANCEMENT = "/api/v1/task/scene_enhancement"
|
|
6
|
+
PATH_REMOVE_BG = "/api/v1/task/remove_bg"
|
|
6
7
|
PATH_CUSTOMER_TAG = "/api/v1/customer_tag"
|
|
7
8
|
|
|
8
9
|
HEADER_ACCESS_KEY = "X-Access-Key"
|
|
@@ -28,3 +29,7 @@ def path_task(task_id):
|
|
|
28
29
|
|
|
29
30
|
def path_cancel(task_id):
|
|
30
31
|
return "/api/v1/task/{}/cancel".format(task_id)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def path_remove_bg_task(task_id):
|
|
35
|
+
return "/api/v1/task/remove_bg/{}".format(task_id)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dxpos-openapi
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: DXPOS OpenAPI Python SDK
|
|
5
5
|
Author-email: DXPOS <support@dxpos.co>
|
|
6
6
|
License: MIT License
|
|
@@ -115,7 +115,7 @@ client = DxposClient(
|
|
|
115
115
|
|
|
116
116
|
## 方法
|
|
117
117
|
|
|
118
|
-
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
118
|
+
可选参数 `customer_tag_id` 只加在预创建、创建任务、查询、取消上。不传或传空不带头;有值时请求加上 `X-Customer-Tag-Id`。这个头不进入签名串。`create_scene_enhancement`、`create_remove_bg` 走 `image_path` 时,预创建和创建任务使用同一个 `customer_tag_id`。
|
|
119
119
|
|
|
120
120
|
### 新增客户标签
|
|
121
121
|
|
|
@@ -184,6 +184,35 @@ resp = client.get_task(task_id, customer_tag_id=customer_tag_id)
|
|
|
184
184
|
resp = client.cancel_task(task_id, customer_tag_id=customer_tag_id)
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
+
### 创建抠图任务
|
|
188
|
+
|
|
189
|
+
`file_id`、`image_path` 必须二选一。`keep_props` 表示是否保留道具:`0` 保留(默认),`1` 不保留只抠人像。
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# 已经 upload_file 拿到 file_id
|
|
193
|
+
resp = client.create_remove_bg(file_id=file_id, keep_props=0)
|
|
194
|
+
|
|
195
|
+
# 本地路径:自动上传再建任务
|
|
196
|
+
resp = client.create_remove_bg(
|
|
197
|
+
image_path="/path/to/portrait.jpg",
|
|
198
|
+
keep_props=1,
|
|
199
|
+
customer_tag_id=customer_tag_id,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
task_id = resp["data"]["task_id"]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 查询抠图任务
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
resp = client.get_remove_bg_task(task_id, customer_tag_id=customer_tag_id)
|
|
209
|
+
# data.status: waiting / processing / done / failed
|
|
210
|
+
# done 时 data.result.remove_bg_url 为按人像裁剪的透明底图,
|
|
211
|
+
# data.result.remove_bg_src_url 为未裁剪、与原图同尺寸的透明底图
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
抠图失败是终态,不会自动重推,本次扣的额度会自动退回。
|
|
215
|
+
|
|
187
216
|
## 维护者:发布到 PyPI
|
|
188
217
|
|
|
189
218
|
不需要把 token 写进仓库。本机配置 `~/.pypirc`,用 `__token__` 和 API token。
|
|
@@ -195,7 +224,7 @@ pip install -e ".[dev]"
|
|
|
195
224
|
pytest
|
|
196
225
|
```
|
|
197
226
|
|
|
198
|
-
|
|
227
|
+
当前版本 `0.0.3`(新增抠图任务):
|
|
199
228
|
|
|
200
229
|
```bash
|
|
201
230
|
rm -rf dist build src/*.egg-info
|
|
@@ -203,9 +232,9 @@ python -m build
|
|
|
203
232
|
twine check dist/*
|
|
204
233
|
twine upload -r testpypi dist/*
|
|
205
234
|
# 干净环境验证:
|
|
206
|
-
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.
|
|
235
|
+
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dxpos-openapi==0.0.3
|
|
207
236
|
twine upload dist/*
|
|
208
|
-
git tag v0.0.
|
|
237
|
+
git tag v0.0.3
|
|
209
238
|
git push origin main --tags
|
|
210
239
|
```
|
|
211
240
|
|
|
@@ -16,6 +16,7 @@ from dxpos_openapi.constants import (
|
|
|
16
16
|
HEADER_TIMESTAMP,
|
|
17
17
|
PATH_CUSTOMER_TAG,
|
|
18
18
|
PATH_FILE,
|
|
19
|
+
PATH_REMOVE_BG,
|
|
19
20
|
PATH_SCENE_ENHANCEMENT,
|
|
20
21
|
PATH_THEME,
|
|
21
22
|
)
|
|
@@ -338,6 +339,80 @@ def test_image_path_reuses_customer_tag(tmp_path, monkeypatch):
|
|
|
338
339
|
assert tags == ["tag1", "tag1"]
|
|
339
340
|
|
|
340
341
|
|
|
342
|
+
def test_create_remove_bg_with_file_id(monkeypatch):
|
|
343
|
+
client = _client()
|
|
344
|
+
calls = []
|
|
345
|
+
|
|
346
|
+
def fake_request(method, url, data=None, headers=None, timeout=None):
|
|
347
|
+
calls.append({"method": method, "url": url, "data": data, "headers": headers})
|
|
348
|
+
return FakeResponse(_ok({"task_id": "rid", "status": "waiting"}))
|
|
349
|
+
|
|
350
|
+
monkeypatch.setattr(client._session, "request", fake_request)
|
|
351
|
+
resp = client.create_remove_bg(file_id="fid", keep_props=1)
|
|
352
|
+
assert resp["code"] == 0
|
|
353
|
+
assert len(calls) == 1
|
|
354
|
+
assert calls[0]["url"].endswith(PATH_REMOVE_BG)
|
|
355
|
+
payload = json.loads(calls[0]["data"].decode("utf-8"))
|
|
356
|
+
assert payload == {"file_id": "fid", "keep_props": 1}
|
|
357
|
+
_assert_signed("POST", PATH_REMOVE_BG, calls[0]["data"], calls[0]["headers"])
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def test_create_remove_bg_with_image_path_chains_upload(tmp_path, monkeypatch):
|
|
361
|
+
image = tmp_path / "a.png"
|
|
362
|
+
image.write_bytes(b"png-bytes")
|
|
363
|
+
client = _client()
|
|
364
|
+
calls = []
|
|
365
|
+
|
|
366
|
+
def fake_request(method, url, data=None, headers=None, timeout=None):
|
|
367
|
+
calls.append({"url": url, "data": data, "tag": headers.get(HEADER_CUSTOMER_TAG)})
|
|
368
|
+
if url.endswith(PATH_FILE):
|
|
369
|
+
return FakeResponse(_ok({"file_id": "fid3", "put_url": "https://cos.example/put"}))
|
|
370
|
+
return FakeResponse(_ok({"task_id": "rid3"}))
|
|
371
|
+
|
|
372
|
+
def fake_put(url, data=None, headers=None, timeout=None):
|
|
373
|
+
calls.append({"put": True})
|
|
374
|
+
return FakeResponse(status_code=200)
|
|
375
|
+
|
|
376
|
+
monkeypatch.setattr(client._session, "request", fake_request)
|
|
377
|
+
monkeypatch.setattr(client._session, "put", fake_put)
|
|
378
|
+
resp = client.create_remove_bg(image_path=str(image), customer_tag_id="tag1")
|
|
379
|
+
assert resp["data"]["task_id"] == "rid3"
|
|
380
|
+
assert [item.get("url", "PUT") for item in calls] == [
|
|
381
|
+
"https://openapi.example" + PATH_FILE,
|
|
382
|
+
"PUT",
|
|
383
|
+
"https://openapi.example" + PATH_REMOVE_BG,
|
|
384
|
+
]
|
|
385
|
+
assert calls[0]["tag"] == calls[2]["tag"] == "tag1"
|
|
386
|
+
payload = json.loads(calls[2]["data"].decode("utf-8"))
|
|
387
|
+
assert payload == {"file_id": "fid3", "keep_props": 0}
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def test_create_remove_bg_invalid_args():
|
|
391
|
+
client = _client()
|
|
392
|
+
none = client.create_remove_bg()
|
|
393
|
+
both = client.create_remove_bg(file_id="a", image_path="/tmp/a.jpg")
|
|
394
|
+
bad_keep = client.create_remove_bg(file_id="a", keep_props=2)
|
|
395
|
+
assert none["code"] == both["code"] == bad_keep["code"] == -1
|
|
396
|
+
assert "二选一" in none["msg"]
|
|
397
|
+
assert "keep_props" in bad_keep["msg"]
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def test_get_remove_bg_task(monkeypatch):
|
|
401
|
+
client = _client()
|
|
402
|
+
captured = {}
|
|
403
|
+
|
|
404
|
+
def fake_request(method, url, data=None, headers=None, timeout=None):
|
|
405
|
+
captured.update({"method": method, "url": url, "headers": headers})
|
|
406
|
+
return FakeResponse(_ok({"task_id": "rid", "status": "done"}))
|
|
407
|
+
|
|
408
|
+
monkeypatch.setattr(client._session, "request", fake_request)
|
|
409
|
+
resp = client.get_remove_bg_task("rid")
|
|
410
|
+
assert resp["data"]["status"] == "done"
|
|
411
|
+
assert captured["method"] == "GET"
|
|
412
|
+
assert captured["url"].endswith("/api/v1/task/remove_bg/rid")
|
|
413
|
+
_assert_signed("GET", "/api/v1/task/remove_bg/rid", b"", captured["headers"])
|
|
414
|
+
|
|
415
|
+
|
|
341
416
|
def test_network_error(monkeypatch):
|
|
342
417
|
client = _client()
|
|
343
418
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|