Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
999d92d
Import order
julien-lang Jul 16, 2025
9777db0
Remove __future__ imports
julien-lang Jul 16, 2025
e3e72cd
Cleanup super prototype
julien-lang Jul 16, 2025
2e3b54b
six.iter....
julien-lang Jul 16, 2025
64fa354
Remove calls to six.text_type and six.binary_type
julien-lang Jul 16, 2025
d014745
Remove calls to ensure_bytes, ensure_text, ensure_strings
julien-lang Jul 16, 2025
153f179
test fixed
eduardoChaucaGallegos Jul 17, 2025
2de2822
fixup! test fixed
julien-lang Jul 17, 2025
24835e3
Black
julien-lang Jul 17, 2025
60bb0bc
Update shotgun_api3/shotgun.py
julien-lang Jul 17, 2025
473b811
six.moves imports
julien-lang Jul 16, 2025
f68f1ae
Cleanup BytesIO import from six
julien-lang Jul 16, 2025
0b956cc
simple json
julien-lang Jul 16, 2025
b94da1a
Cleanup Py2-3 compat with ImportError
julien-lang Jul 16, 2025
6e89b98
Simplify Base64
julien-lang Jul 16, 2025
439d0b3
fixup! six.moves imports
julien-lang Jul 17, 2025
adbc0da
fixup! six.moves imports
julien-lang Jul 17, 2025
c4d1e30
Remove deprecated custome mimetype module
julien-lang Jul 16, 2025
e93ed1e
Remove deprecated backported mock module
julien-lang Jul 16, 2025
12f1abe
Fixup assert_called_once
julien-lang Jul 17, 2025
ea953d2
Fixup CI tests
julien-lang Jul 17, 2025
f45faac
fixup! Fixup CI tests
julien-lang Jul 17, 2025
6a2b3e2
provides debug info
julien-lang Jul 17, 2025
cb800c1
fixup! provides debug info
julien-lang Jul 17, 2025
a4afffa
fixup! Remove deprecated backported mock module
julien-lang Jul 17, 2025
77c9cd3
Remove python2 from httplib2 module
julien-lang Jul 16, 2025
6124681
fixup issue with ssl_error_classes
julien-lang Jul 17, 2025
10119ec
Cleanup six.PY2/six.PY3 conditions
julien-lang Jul 16, 2025
c9648c1
Remove useless test in Python 3
julien-lang Jul 16, 2025
e7ca1eb
Replace sgsix.file_types by io.IOBase
julien-lang Jul 16, 2025
3cbc5ff
Replace ShotgunSSLError by ssl.SSLError
julien-lang Jul 16, 2025
5d8b18d
Cleanup Python-2 related comments and workarounds
julien-lang Jul 17, 2025
b90a64b
fixup! Cleanup six.PY2/six.PY3 conditions
julien-lang Jul 17, 2025
77fd8cc
recomendation fixed
eduardoChaucaGallegos Jul 18, 2025
e581b5e
pulling from master and conflicts fixed
eduardoChaucaGallegos Sep 10, 2025
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
Prev Previous commit
Next Next commit
Simplify Base64
  • Loading branch information
julien-lang committed Jul 17, 2025
commit 6e89b9826e529d8859bbdb472adba73c9a44a14a
14 changes: 5 additions & 9 deletions shotgun_api3/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

import base64
import copy
import datetime
import json
Expand Down Expand Up @@ -59,11 +60,6 @@
from .lib.httplib2 import Http, ProxyInfo, socks, ssl_error_classes
from .lib.sgtimezone import SgTimezone

if six.PY3:
from base64 import encodebytes as base64encode
else:
from base64 import encodestring as base64encode


LOG = logging.getLogger("shotgun_api3")
"""
Expand Down Expand Up @@ -709,13 +705,13 @@ def __init__(
# and auth header

# Do NOT self._split_url(self.base_url) here, as it contains the lower
# case version of the base_url argument. Doing so would base64encode
# case version of the base_url argument. Doing so would base64.encodebytes
# the lowercase version of the credentials.
auth, self.config.server = self._split_url(base_url)
if auth:
auth = base64encode(urllib.parse.unquote(auth).encode("utf-8")).decode(
"utf-8"
)
auth = base64.encodebytes(
urllib.parse.unquote(auth).encode("utf-8")
).decode("utf-8")
self.config.authorization = "Basic " + auth.strip()

# foo:bar@123.456.789.012:3456
Expand Down
8 changes: 2 additions & 6 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
CRUD functions. These tests always use a mock http connection so not not
need a live server to run against."""

import base64
import datetime
import json
import os
Expand All @@ -32,17 +33,12 @@
from shotgun_api3.shotgun import ServerCapabilities, SG_TIMEZONE
from . import base

if six.PY3:
from base64 import encodebytes as base64encode
else:
from base64 import encodestring as base64encode


def b64encode(val):
if isinstance(val, str):
val = val.encode("utf-8")

return base64encode(val).decode("utf-8")
return base64.encodebytes(val).decode("utf-8")


class TestShotgunClient(base.MockTestBase):
Expand Down
Loading