From 1ab057a4b3d1c79af37f00d69eb46d1fac139ca3 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Thu, 13 Nov 2025 16:40:35 -0800 Subject: [PATCH 1/4] Update outdated link to Python documentation --- shotgun_api3/shotgun.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py index 0c0c9cd5c..247820a64 100644 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -406,7 +406,8 @@ def __init__(self, sg: "Shotgun"): # In the case that the environment variable is already set, setting the # property on the config will override it. self.rpc_attempt_interval = 3000 - # From http://docs.python.org/2.6/library/httplib.html: + + # From https://docs.python.org/3.9/library/http.client.html: # If the optional timeout parameter is given, blocking operations # (like connection attempts) will timeout after that many seconds # (if it is not given, the global default timeout setting is used) From a89eae450789f770f5cf7da370cfcae91ff88f07 Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Fri, 24 Oct 2025 12:22:27 -0700 Subject: [PATCH 2/4] Improve and fix documentation about logger --- docs/cookbook/usage_tips.rst | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/cookbook/usage_tips.rst b/docs/cookbook/usage_tips.rst index 5d1a7bc1f..128f417ea 100644 --- a/docs/cookbook/usage_tips.rst +++ b/docs/cookbook/usage_tips.rst @@ -236,26 +236,38 @@ automatically set whenever an entity is created or updated. Logging Messages from the API ***************************** -The API uses standard python logging but does not define a handler. +The library uses the standard Python logging module under the logger name +``shotgun_api3``. Developers are free to configure logging handlers as they see +fit in their applications. To see the logging output in stdout, define a streamhandler in your script:: import logging - import shotgun_api3 as shotgun - logging.basicConfig(level=logging.DEBUG) + logging.basicConfig() + + import shotgun_api3 + + sg_log = logging.getLogger("shotgun_api3") + sg_log.setLevel(logging.DEBUG) + To write logging output from the Flow Production Tracking API to a file, define a file handler in your script:: import logging - import shotgun_api3 as shotgun - logging.basicConfig(level=logging.DEBUG, filename='/path/to/your/log') + logging.basicConfig(filename="/path/to/your/log") + + import shotgun_api3 + + sg_log = logging.getLogger("shotgun_api3") + sg_log.setLevel(logging.DEBUG) + To suppress the logging output from the API in a script which uses logging, set the level of the Flow Production Tracking logger to a higher level:: import logging import shotgun_api3 as shotgun - sg_log = logging.getLogger('shotgun_api3') + sg_log = logging.getLogger("shotgun_api3") sg_log.setLevel(logging.ERROR) ************* From ed4dc3fc7346bee0b39dcfcf487378662fd16a8e Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Fri, 24 Oct 2025 12:13:28 -0700 Subject: [PATCH 3/4] Fixup wrong doc string information about return value --- shotgun_api3/shotgun.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py index 247820a64..b0178fe0b 100644 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -4481,7 +4481,7 @@ def _upload_data_to_storage( :param str content_type: Content type of the data stream. :param int size: Number of bytes in the data stream. :param str storage_url: Target URL for the uploaded file. - :returns: upload url. + :returns: etag of the uploaded file (hash of the file content). :rtype: str """ From bfe92636c80b1e4be04d2869da850f85a5555a5d Mon Sep 17 00:00:00 2001 From: Julien Langlois Date: Fri, 24 Oct 2025 12:10:35 -0700 Subject: [PATCH 4/4] remove useless try/except --- shotgun_api3/shotgun.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py index b0178fe0b..2e933fd53 100644 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -3982,12 +3982,7 @@ def _make_upload_request( Open the given request object, return the response, raises URLError on protocol errors. """ - try: - result = opener.open(request) - - except urllib.error.HTTPError: - raise - return result + return opener.open(request) def _parse_http_status(self, status: tuple) -> None: """