shotgun-api3 3.9.1__tar.gz → 3.9.2__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.
- {shotgun_api3-3.9.1/shotgun_api3.egg-info → shotgun_api3-3.9.2}/PKG-INFO +1 -1
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/setup.py +1 -1
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/shotgun.py +24 -1
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2/shotgun_api3.egg-info}/PKG-INFO +1 -1
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_api.py +77 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/LICENSE +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/README.md +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/setup.cfg +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/__init__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/__init__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/certifi/__init__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/certifi/__main__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/certifi/cacert.pem +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/certifi/core.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/certifi/py.typed +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/__init__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/auth.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/cacerts.txt +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/certs.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/error.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/iri2uri.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/httplib2/socks.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/mockgun/__init__.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/mockgun/errors.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/mockgun/mockgun.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/mockgun/schema.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/pyparsing.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/lib/sgtimezone.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3/py.typed +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3.egg-info/SOURCES.txt +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3.egg-info/dependency_links.txt +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3.egg-info/not-zip-safe +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/shotgun_api3.egg-info/top_level.txt +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_api_long.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_client.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_mockgun.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_proxy.py +0 -0
- {shotgun_api3-3.9.1 → shotgun_api3-3.9.2}/tests/test_unit.py +0 -0
|
@@ -94,7 +94,7 @@ SHOTGUN_API_DISABLE_ENTITY_OPTIMIZATION = False
|
|
|
94
94
|
|
|
95
95
|
# ----------------------------------------------------------------------------
|
|
96
96
|
# Version
|
|
97
|
-
__version__ = "3.9.
|
|
97
|
+
__version__ = "3.9.2"
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
# ----------------------------------------------------------------------------
|
|
@@ -1882,6 +1882,29 @@ class Shotgun(object):
|
|
|
1882
1882
|
|
|
1883
1883
|
return self._call_rpc("work_schedule_update", params)
|
|
1884
1884
|
|
|
1885
|
+
def export_page(self, page_id, format, layout_name=None):
|
|
1886
|
+
"""
|
|
1887
|
+
Export the specified page to the given format.
|
|
1888
|
+
This method allows you to export a page to CSV.
|
|
1889
|
+
Respective layout or page should be marked as API Exportable in the Flow Production Tracking UI.
|
|
1890
|
+
For more information, see documentation_.
|
|
1891
|
+
.. _documentation: https://help.autodesk.com/view/SGSUB/ENU/?guid=SG_Tutorials_tu_export_csv_html#enable-api-export-for-a-page
|
|
1892
|
+
If ``layout_name`` is not passed in, the default layout name will be used.
|
|
1893
|
+
>>> sg.export_page(12345, "csv", layout_name="My Layout")
|
|
1894
|
+
"ID,Name,Status\\n1,Shot 001,ip\\n2, Shot 002,rev\\n"
|
|
1895
|
+
>>> sg.export_page(12345, "csv")
|
|
1896
|
+
"ID,Name,Status\\n1,Shot 001,ip\\n2,Shot 002,rev\\n"
|
|
1897
|
+
:param int page_id: The ID of the page to export.
|
|
1898
|
+
:param str format: The format to export the page to. Supported format is ``"csv"``.
|
|
1899
|
+
:param str layout_name: Optional layout name. This should be the name of the layout seen in the Flow Production Tracking UI.
|
|
1900
|
+
:returns: string containing data of the given page.
|
|
1901
|
+
:rtype: string
|
|
1902
|
+
"""
|
|
1903
|
+
|
|
1904
|
+
params = dict(format=format, page_id=page_id, layout_name=layout_name)
|
|
1905
|
+
|
|
1906
|
+
return self._call_rpc("export_page", params)
|
|
1907
|
+
|
|
1885
1908
|
def follow(self, user: Dict[str, Any], entity: Dict[str, Any]) -> Dict[str, Any]:
|
|
1886
1909
|
"""
|
|
1887
1910
|
Add the entity to the user's followed entities.
|
|
@@ -1947,6 +1947,83 @@ class TestFind(base.LiveTestBase):
|
|
|
1947
1947
|
self.sg.update("Project", self.project["id"], {"archived": False})
|
|
1948
1948
|
|
|
1949
1949
|
|
|
1950
|
+
class TestExportPage(base.LiveTestBase):
|
|
1951
|
+
|
|
1952
|
+
def setUp(self):
|
|
1953
|
+
super(TestExportPage, self).setUp("HumanUser")
|
|
1954
|
+
|
|
1955
|
+
def test_export_page_unavailable(self):
|
|
1956
|
+
"""
|
|
1957
|
+
Test export_page raises when report does not exist.
|
|
1958
|
+
"""
|
|
1959
|
+
if not self.sg.server_caps.version or self.sg.server_caps.version < (5, 1, 22):
|
|
1960
|
+
return
|
|
1961
|
+
|
|
1962
|
+
page_entity = self.sg.create("Page", {"entity_type": "Shot"})
|
|
1963
|
+
|
|
1964
|
+
with self.assertRaises(Exception) as cm:
|
|
1965
|
+
self.sg.export_page(page_entity["id"], "csv")
|
|
1966
|
+
self.assertIn(
|
|
1967
|
+
f"This functionality is currently not available", str(cm.exception)
|
|
1968
|
+
)
|
|
1969
|
+
|
|
1970
|
+
with self.assertRaises(Exception) as cm:
|
|
1971
|
+
self.sg.export_page(page_entity["id"], "csv", layout_name="My Layout")
|
|
1972
|
+
self.assertIn(
|
|
1973
|
+
f"This functionality is currently not available", str(cm.exception)
|
|
1974
|
+
)
|
|
1975
|
+
|
|
1976
|
+
def test_export_page_format_missing(self):
|
|
1977
|
+
"""
|
|
1978
|
+
Test export_page raises for invalid format.
|
|
1979
|
+
"""
|
|
1980
|
+
if not self.sg.server_caps.version or self.sg.server_caps.version < (5, 1, 22):
|
|
1981
|
+
return
|
|
1982
|
+
|
|
1983
|
+
with self.assertRaises(Exception) as cm:
|
|
1984
|
+
self.sg.export_page(11, None)
|
|
1985
|
+
self.assertIn("'format' missing", str(cm.exception))
|
|
1986
|
+
|
|
1987
|
+
with self.assertRaises(Exception) as cm:
|
|
1988
|
+
self.sg.export_page(11, None, layout_name="My Layout")
|
|
1989
|
+
self.assertIn("'format' missing", str(cm.exception))
|
|
1990
|
+
|
|
1991
|
+
def test_export_page_missing_page_id(self):
|
|
1992
|
+
"""
|
|
1993
|
+
Test export_page raises for missing page id.
|
|
1994
|
+
"""
|
|
1995
|
+
if not self.sg.server_caps.version or self.sg.server_caps.version < (5, 1, 22):
|
|
1996
|
+
return
|
|
1997
|
+
|
|
1998
|
+
with self.assertRaises(Exception) as cm:
|
|
1999
|
+
self.sg.export_page(None, "csv")
|
|
2000
|
+
self.assertIn("'page_id' missing", str(cm.exception))
|
|
2001
|
+
|
|
2002
|
+
with self.assertRaises(Exception) as cm:
|
|
2003
|
+
self.sg.export_page(None, "csv", layout_name="My Layout")
|
|
2004
|
+
self.assertIn("'page_id' missing", str(cm.exception))
|
|
2005
|
+
|
|
2006
|
+
@unittest.mock.patch("shotgun_api3.shotgun.Http.request")
|
|
2007
|
+
def test_export_page_without_layout_name(self, mock_request):
|
|
2008
|
+
"""
|
|
2009
|
+
Test export_page works when layout_name is not provided.
|
|
2010
|
+
"""
|
|
2011
|
+
|
|
2012
|
+
if not self.sg.server_caps.version or self.sg.server_caps.version < (5, 1, 22):
|
|
2013
|
+
return
|
|
2014
|
+
|
|
2015
|
+
# Mock the underlying Http.request to return CSV content with appropriate headers
|
|
2016
|
+
csv_body = "ID,Name,Status\n1,Shot 001,ip\n2,Shot 002,rev\n"
|
|
2017
|
+
response = unittest.mock.MagicMock(name="response mock")
|
|
2018
|
+
response.status = 200
|
|
2019
|
+
response.reason = "OK"
|
|
2020
|
+
response.items.return_value = [("content-type", "text/csv; charset=utf-8")]
|
|
2021
|
+
mock_request.return_value = (response, csv_body)
|
|
2022
|
+
result = self.sg.export_page(11, "csv")
|
|
2023
|
+
self.assertIsInstance(result, str)
|
|
2024
|
+
self.assertTrue(result.startswith("ID,Name,Status"))
|
|
2025
|
+
|
|
2026
|
+
|
|
1950
2027
|
class TestFollow(base.LiveTestBase):
|
|
1951
2028
|
|
|
1952
2029
|
def test_follow_unfollow(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|