Skip to content

Commit

Permalink
Merge pull request #6 from skylab-tech/SCP-3-v2
Browse files Browse the repository at this point in the history
Scp 3 v2
  • Loading branch information
kev-le authored Mar 6, 2024
2 parents 21995d9 + dcee798 commit 3f822a8
Show file tree
Hide file tree
Showing 9 changed files with 605 additions and 407 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Studio PY SDK"
name: 'Studio PY SDK'
on: [push]

concurrency:
Expand All @@ -21,11 +21,14 @@ jobs:
- name: Update system
run: sudo apt-get update

- name: Install libvips
run: sudo apt install libvips-dev --no-install-recommends

- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: '3.x'

- name: Install dependencies
run: |
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Studio Client SDK publish to PyPi'

on:
push:
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ api.queue_job(job.id, payload)
# We will send a response to the specified callback_url with the output photo download urls
```

```python
# OPTIONAL: If you want this SDK to handle photo downloads to a specified output folder

# FETCH COMPLETED JOB (wait until job status is completed)
completed_job = api.get_job(queued_job['id']);

# DOWNLOAD COMPLETED JOB PHOTOS
photos_list = completed_job['photos'];
await api.download_all_photos(photos_list, completed_job['profile'], "photos/output/");
```

## Usage

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

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

#### List all photos

```python
api.list_photos()
```

#### Get photo

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

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.

#### Download photo(s)

This function handles downloading the output photos to a specified directory.

```dotnet
photos_list = completed_job.photos;
download_results = await api.download_all_photos(photos_list, completed_job.profile, "/output/folder/path");
print(download_results)
Output:
{'success_photos': ['1.JPG'], 'errored_photos': []}
```

OR

```dotnet
api.download_photo(photo_id, "/output/folder/path");
```

#### Delete photo

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.
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
aiohttp>=3.9.3
pylint>=1.8.3
pytest-cov>=2.6.1
pytest>=3.0.5
pyvips>=2.2.2
requests>=2.0.0
requests_mock>=1.5.2
decouple>=0.0.7
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='skylab_studio',
version='0.0.10',
version='0.0.11',
author='skylabtech',
author_email='[email protected]',
packages=find_packages(),
Expand All @@ -23,6 +23,8 @@
long_description_content_type="text/markdown",
test_suite="skylabtech.test",
install_requires=[
"aiohttp >= 3.9.3",
"pyvips >= 2.2.2",
"requests >= 2.0.0"
],
extras_require={
Expand Down
Loading

0 comments on commit 3f822a8

Please sign in to comment.