Skip to content
This repository was archived by the owner on Jan 20, 2020. It is now read-only.

fix for python3 #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion dockercloud/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

def authenticate(username, password):
verify_credential(username, password)
dockercloud.basic_auth = base64.b64encode("%s:%s" % (username, password))
cred = "%s:%s" % (username, password)
dockercloud.basic_auth = base64.b64encode(cred.encode()).decode()


def verify_credential(username, password):
Expand Down
2 changes: 1 addition & 1 deletion dockercloud/api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def new_session():

def send_request(method, path, inject_header=True, **kwargs):
json = None
url = urljoin(dockercloud.rest_host.rstrip("/"), path.strip("/").encode("ascii", "ignore"))
url = urljoin(dockercloud.rest_host.rstrip("/"), str(path).strip("/"))
if not url.endswith("/"):
url = "%s/" % url
user_agent = 'python-dockercloud/%s' % dockercloud.__version__
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_auth_get_auth_header(self):
dockercloud.basic_auth = FAKE_BASIC_AUTH
self.assertEqual({'Authorization': FAKE_DOCKERCLOUD_AUTH}, dockercloud.auth.get_auth_header())

print "===================="
print("====================")
dockercloud.dockercloud_auth = None
dockercloud.basic_auth = FAKE_BASIC_AUTH
self.assertEqual({'Authorization': 'Basic %s' % (FAKE_BASIC_AUTH)}, dockercloud.auth.get_auth_header())
Expand Down