Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions shotgun_api3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import warnings

if sys.version_info < (3, 7):
if sys.version_info < (3, 9):
if os.environ.get("SHOTGUN_ALLOW_OLD_PYTHON", "0") != "1":
# This is our preferred default behavior when using an old
# unsupported Python version.
Expand All @@ -21,25 +21,17 @@
# Python traceback and trying to understand this is due to using an
# unsupported Python version.

raise RuntimeError("This module requires Python version 3.7 or higher.")
raise RuntimeError("This module requires Python version 3.9 or higher.")

warnings.warn(
"Python versions older than 3.7 are no longer supported as of January "
"2023. Since the SHOTGUN_ALLOW_OLD_PYTHON variable is enabled, this "
"Python versions older than 3.9 are no longer supported as of March "
"2025. Since the SHOTGUN_ALLOW_OLD_PYTHON variable is enabled, this "
"module is raising a warning instead of an exception. "
"However, it is very likely that this module will not be able to work "
"on this Python version.",
RuntimeWarning,
stacklevel=2,
)
elif sys.version_info < (3, 9):
warnings.warn(
"Python versions older than 3.9 are no longer supported as of March "
"2025 and compatibility will be discontinued after March 2026. "
"Please update to Python 3.13 or any other supported version.",
DeprecationWarning,
stacklevel=2,
)


from .shotgun import (
Expand Down
27 changes: 9 additions & 18 deletions shotgun_api3/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,27 +740,18 @@
"""
Extract the hostname:port and username/password/token from base_url
sent when connect to the API.

In python 3.8 `urllib.parse.splituser` was deprecated warning devs to
use `urllib.parse.urlparse`.
"""
if (sys.version_info.major, sys.version_info.minor) >= (3, 8):
auth = None
results = urllib.parse.urlparse(base_url)
server = results.hostname
if results.port:
server = "{}:{}".format(server, results.port)

if results.username:
auth = results.username
auth = None
results = urllib.parse.urlparse(base_url)
server = results.hostname
if results.port:
server = "{}:{}".format(server, results.port)

if results.password:
auth = "{}:{}".format(auth, results.password)
if results.username:

Check notice on line 750 in shotgun_api3/shotgun.py

View check run for this annotation

ShotGrid Chorus / privacy/bearer

Potential PII: Identification Username

This check is currently in beta. - Personal Data at Autodesk: https://share.autodesk.com/:b:/r/sites/LegalTopicsToolkits/Shared%20Documents/Personal%20Data%20at%20Autodesk.pdf - Data Privacy & Governance Policies at Autodesk: https://share.autodesk.com/sites/DPG/SitePages/Policies-%26-Guidelines.aspx
auth = results.username

Check notice on line 751 in shotgun_api3/shotgun.py

View check run for this annotation

ShotGrid Chorus / privacy/bearer

Potential PII: Identification Username

This check is currently in beta. - Personal Data at Autodesk: https://share.autodesk.com/:b:/r/sites/LegalTopicsToolkits/Shared%20Documents/Personal%20Data%20at%20Autodesk.pdf - Data Privacy & Governance Policies at Autodesk: https://share.autodesk.com/sites/DPG/SitePages/Policies-%26-Guidelines.aspx

else:
auth, server = urllib.parse.splituser(
urllib.parse.urlsplit(base_url).netloc
)
if results.password:
auth = "{}:{}".format(auth, results.password)

return auth, server

Expand Down