# HG changeset patch # User Sebastien Jodogne # Date 1618820904 -7200 # Node ID 844ec5ecb6ef1321e73985255776a63eea276a8b # Parent 926fa5ef8b4f7d0cfcfc7938bf981c206a45571b Fix "OrthancServer/Resources/Samples/Python/Replicate.py" for Python 3.x diff -r 926fa5ef8b4f -r 844ec5ecb6ef NEWS --- a/NEWS Thu Apr 15 11:29:40 2021 +0200 +++ b/NEWS Mon Apr 19 10:28:24 2021 +0200 @@ -12,6 +12,7 @@ ----------- * Use the local timezone for query/retrieve in the Orthanc Explorer interface (was UTC before) +* Fix "OrthancServer/Resources/Samples/Python/Replicate.py" for Python 3.x * Upgraded dependencies for static builds (notably on Windows and LSB): - civetweb 1.14 diff -r 926fa5ef8b4f -r 844ec5ecb6ef OrthancServer/Resources/Samples/Python/Replicate.py --- a/OrthancServer/Resources/Samples/Python/Replicate.py Thu Apr 15 11:29:40 2021 +0200 +++ b/OrthancServer/Resources/Samples/Python/Replicate.py Mon Apr 19 10:28:24 2021 +0200 @@ -51,7 +51,12 @@ # Authentication (for some weird reason, this method does not # always work) # http://en.wikipedia.org/wiki/Basic_access_authentication - headers['authorization'] = 'Basic ' + base64.b64encode(username + ':' + password) + + # The ".encode()" and ".decode()" below fix the following issue: + # https://groups.google.com/g/orthanc-users/c/KZ_iYOet5IQ/m/AUQWiSiAAQAJ + credentials = (username + ':' + password) + credentials_base64 = base64.b64encode(credentials.encode("ascii")).decode("ascii") + headers['authorization'] = 'Basic ' + credentials_base64 return headers