https://github.com/rsgalloway/shotgrid
object-oriented wrapper around the shotun api3 Python API
https://github.com/rsgalloway/shotgrid
shotgrid shotgrid-pipeline shotgun vfx-pipeline
Last synced: 3 months ago
JSON representation
object-oriented wrapper around the shotun api3 Python API
- Host: GitHub
- URL: https://github.com/rsgalloway/shotgrid
- Owner: rsgalloway
- License: other
- Created: 2024-11-19T13:45:50.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-11-19T14:43:52.000Z (11 months ago)
- Last Synced: 2024-11-19T14:54:24.408Z (11 months ago)
- Topics: shotgrid, shotgrid-pipeline, shotgun, vfx-pipeline
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
shotgrid
========This is an object-oriented wrapper around the shotun api3 Python API, that
includes classes for each shotgrid entity type with convenience methods.## Installation
The easiest way to install:
```bash
$ pip install -U shotgrid
```Alternatively, use [distman](https://github.com/rsgalloway/distman) to dist to a
deployment area using options defined in the `dist.json` file:```bash
$ distman [-d]
```## Configuration
Default settings are stored in an [envstack](https://github.com/rsgalloway/envstack)
environment stack file. They can be stored in the default stack, or in a
namespaced `shotgrid.env` stack file to keep settings separate.Start by renaming or copying the `example_shotgrid.env` file:
```bash
$ cp example_shotgrid.env shotgrid.env
```Then edit it's contents with the appropriate values:
```yaml
SG_SCRIPT_URL: https://example.shotgunstudio.com
SG_SCRIPT_NAME: script_name
SG_SCRIPT_KEY: XXXXXXXXXXXX
```#### Encrypted keys
To use encrypted keys in the env file, see the encryption instructions on the
envstack README [here](https://github.com/rsgalloway/envstack?tab=readme-ov-file#encryption).```yaml
SG_SCRIPT_KEY: !encrypt XXXXXXXXXXXX
SG_SCRIPT_NAME: !encrypt XXXXXXXXXXXX
```Using AES-GCM or Fernet encryption, keys can be safely stored.
## Usage
Basic usage:
```python
>>> from shotgrid import Shotgrid
>>> sg = Shotgrid()
>>> show = sg.get_projects("Demo: Animation")[0]
>>> shot = show.get_shots("bunny_080_0200")[0]
>>> tasks = shot.get_tasks()
```Requests can be strung together:
```python
>>> sg.get_projects("Demo: Animation")[0].get_sequences("080")[0].get_shots()
[, , ]
```#### Core API
The Shotgrid class is a subclass of shotgrid_api3.Shotgrid, so you can drop down
to the core API at any time or from any object:```python
>>> sg.find(filters, fields)
>>> shot.api().find("Task", [["id", "is", 12345]])
[{'type': 'Task', 'id': 12345}]
```#### Download Versions
```python
>>> version = sg.get_projects(show)[0].get_shots(shot)[0].get_versions()[0]
>>> version.movie>>> version.movie.download("/var/tmp")
```