changeset 4626:686f189a903d db-changes

integration mainline->db-changes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 19 Apr 2021 10:28:43 +0200
parents 6adeaff62b42 (current diff) 844ec5ecb6ef (diff)
children f7d5372b59b3
files NEWS
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Apr 16 17:45:02 2021 +0200
+++ b/NEWS	Mon Apr 19 10:28:43 2021 +0200
@@ -26,6 +26,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
 
--- a/OrthancServer/Resources/Samples/Python/Replicate.py	Fri Apr 16 17:45:02 2021 +0200
+++ b/OrthancServer/Resources/Samples/Python/Replicate.py	Mon Apr 19 10:28:43 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