Skip to content

Commit 3f822a8

Browse files
authored
Merge pull request #6 from skylab-tech/SCP-3-v2
Scp 3 v2
2 parents 21995d9 + dcee798 commit 3f822a8

File tree

9 files changed

+605
-407
lines changed

9 files changed

+605
-407
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Studio PY SDK"
1+
name: 'Studio PY SDK'
22
on: [push]
33

44
concurrency:
@@ -21,11 +21,14 @@ jobs:
2121
- name: Update system
2222
run: sudo apt-get update
2323

24+
- name: Install libvips
25+
run: sudo apt install libvips-dev --no-install-recommends
26+
2427
- uses: actions/checkout@v4
2528
- name: Set up Python
2629
uses: actions/setup-python@v4
2730
with:
28-
python-version: "3.x"
31+
python-version: '3.x'
2932

3033
- name: Install dependencies
3134
run: |

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Studio Client SDK publish to PyPi'
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
# IMPORTANT: this permission is mandatory for trusted publishing
17+
id-token: write
18+
19+
steps:
20+
- name: Publish distribution 📦 to PyPI
21+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ api.queue_job(job.id, payload)
4444
# We will send a response to the specified callback_url with the output photo download urls
4545
```
4646

47+
```python
48+
# OPTIONAL: If you want this SDK to handle photo downloads to a specified output folder
49+
50+
# FETCH COMPLETED JOB (wait until job status is completed)
51+
completed_job = api.get_job(queued_job['id']);
52+
53+
# DOWNLOAD COMPLETED JOB PHOTOS
54+
photos_list = completed_job['photos'];
55+
await api.download_all_photos(photos_list, completed_job['profile'], "photos/output/");
56+
```
57+
4758
## Usage
4859

4960
For all examples, assume:
@@ -162,12 +173,6 @@ api.update_profile(profile_id, payload=payload)
162173

163174
For all payload options, consult the [API documentation](https://studio-docs.skylabtech.ai/#tag/profile/operation/updateProfileById).
164175

165-
#### List all photos
166-
167-
```python
168-
api.list_photos()
169-
```
170-
171176
#### Get photo
172177

173178
```python
@@ -194,6 +199,27 @@ api.upload_profile_photo(photo_path, profile_id)
194199

195200
If upload fails, the photo object is deleted for you. If upload succeeds and you later decide you no longer want to include that image, use delete_photo to remove it.
196201

202+
#### Download photo(s)
203+
204+
This function handles downloading the output photos to a specified directory.
205+
206+
```dotnet
207+
photos_list = completed_job.photos;
208+
209+
download_results = await api.download_all_photos(photos_list, completed_job.profile, "/output/folder/path");
210+
211+
print(download_results)
212+
213+
Output:
214+
{'success_photos': ['1.JPG'], 'errored_photos': []}
215+
```
216+
217+
OR
218+
219+
```dotnet
220+
api.download_photo(photo_id, "/output/folder/path");
221+
```
222+
197223
#### Delete photo
198224

199225
This will remove the photo from the job/profile's bucket. Useful for when you've accidentally uploaded an image that you'd like removed.

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
aiohttp>=3.9.3
12
pylint>=1.8.3
23
pytest-cov>=2.6.1
34
pytest>=3.0.5
5+
pyvips>=2.2.2
46
requests>=2.0.0
57
requests_mock>=1.5.2
68
decouple>=0.0.7

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
setup(
1313
name='skylab_studio',
14-
version='0.0.10',
14+
version='0.0.11',
1515
author='skylabtech',
1616
author_email='[email protected]',
1717
packages=find_packages(),
@@ -23,6 +23,8 @@
2323
long_description_content_type="text/markdown",
2424
test_suite="skylabtech.test",
2525
install_requires=[
26+
"aiohttp >= 3.9.3",
27+
"pyvips >= 2.2.2",
2628
"requests >= 2.0.0"
2729
],
2830
extras_require={

0 commit comments

Comments
 (0)