/python-api

Shotgun Python API

Primary LanguagePythonOtherNOASSERTION

Shotgun Python API

Shotgun provides a simple Python-based API for accessing Shotgun and integrating with other tools. This is the official API that is maintained by Shotgun Software (support@shotgunsoftware.com)

New Home

GitHub is the new official location for the latest Shotgun Python API. We will no longer be including it in our code tree that is deployed to your servers or posting it for download from our support site. So update your bookmarks!

Minimum Requirements

  • Shotgun server v2.4.12 or higher. (Earlier builds of 2.4 will work, but have buggy support for float field types)
  • Python v2.4 - v2.7. (We do have plans to eventually support Python 3)

High Performance Requirements

Installing

To use Shotgun's Python API module, you need to place the package shotgun_api3 in one of the directories specified by the environment variable PYTHONPATH. For more information on PYTHONPATH and using modules in Python, see http://docs.python.org/tutorial/modules.html

Installing with pip

To install this package with pip, run the following command: pip install -e git://github.com/shotgunsoftware/python-api.git#egg=shotgun_api3

If you're using pip with requirements.txt, add the following line: -e git://github.com/shotgunsoftware/python-api.git#egg=shotgun_api3

Documentation

Tutorials and detailed documentation about the Python API are available on the Python API Wiki. There is also some additional related documentation on the Shotgun Support Website. Some useful direct links in each are below:

Tests

Integration and unit tests are provided.

Build Status

  • test_client and tests_unit mock server interaction and do not require a shotgun instance to be available.
  • test_api and test_api_long do require a shotgun instance, with a script key available for the tests. These tests rely on a tests/config file, which can be created by renaming example_config and supplying the server and script user values. The tests will set up test data on the server based on the data set forth in the config. This data will be manipulated by the tests, and should not be used for other purposes.
  • To run all of the tests, use the shell script run-tests. This script require nose to be installed.

Changelog

v3.0.9.beta2 - 2012 Mar 19

  • use relative imports for included libraries when using Python v2.5 or later
  • replace sideband request for 'image' (thumbnail) field with native support (requires Shotgun server >= v3.3.0. Request will still work on older versions but fallback to slow sideband method)
  • allow setting image and filmstrip_thumbnail in data dict on create() and update() (thanks to Hugh Macdonald https://github.com/HughMacdonald)
  • fixed bug causing Attachment.tag_list to be set to "None" (str) for uploads

v3.0.9.beta1 - 2012 Feb 23

  • added support for access to WorkDayRules (requires Shotgun server >= v3.2.0)
  • added support for filmstrip thumbnails (requires Shotgun server >= v3.1.0)
  • fixed download_attachment() pointing to incorrect url
  • fixed some issues with module import paths

v3.0.8 - 2011 Oct 7

  • now uses JSON as a transport rather than XML-RPC. This provides as much as a 40% speed boost
  • added the summarize method
  • refactored single file into package
  • tests added (Thanks to Aaron Morton https://github.com/amorton)
  • return all strings as ascii for backwards compatibility, added ensure_ascii parameter to enable returning unicode

v3.0.7 - 2011 Apr 04

  • fix: update() method should return a dict object not a list

v3.0.6 - 2010 Jan 25

  • optimization: don't request paging_info unless required (and server support is available)

v3.0.5 - 2010 Dec 20

  • officially remove support for old api3_preview controller
  • find(): allow requesting a specific page of results instead of returning them all at once
  • add support for "session_uuid" parameter for communicating with a web browser session.

v3.0.4 - 2010 Nov 22

  • fix for issue where create() method was returning list type instead of dictionary
  • support new style classes (thanks to Alex Schworer https://github.com/schworer)

v3.0.3 - 2010 Nov 12

  • add support for local files. Injects convenience info into returned hash for local file links
  • add support for authentication through http proxy server

v3.0.2 - 2010 Aug 27

  • add revive() method to revive deleted entities

v3.0.1 - 2010 May 10

  • find(): default sorting to ascending, if not set (instead of requiring ascending/descending)
  • upload() and upload_thumbnail(): pass auth info through

v3.0 - 2010 May 5

  • non-beta!
  • add batch() method to do multiple create, update, and delete requests in one request to the server (requires Shotgun server to be v1.13.0 or higher)

v3.0b8 - 2010 February 19

v3.0b7 - 2009 November 30

  • add additional retries for connection errors and a catch for broken pipe exceptions

v3.0b6 - 2009 October 20

  • add support for HTTP/1.1 keepalive, which greatly improves performance for multiple requests
  • add more helpful error if server entered is not http or https
  • add support assigning tags to file uploads (for Shotgun version >= 1.10.6)

v3.0b5 - 2009 Sept 29

  • fixed deprecation warnings to raise Exception class for python 2.5

v3.0b4 - 2009 July 3

  • made upload() and upload_thumbnail() methods more backwards compatible
  • changes to find_one():
    • now defaults to no filter_operator

v3.0b3 - 2009 June 24

  • fixed upload() and upload_thumbnail() methods
  • added download_attchment() method
  • added schema_* methods for accessing entities and fields
  • added support for http proxy servers
  • added version string
  • removed RECORDS_PER_PAGE global (can just set records_per_page on the Shotgun object after initializing it)
  • removed api_ver from the constructor, as this class is only designed to work with api v3