Replace deprecated function call

This commit is contained in:
Lance Edgar 2022-07-29 13:42:48 -05:00
parent 853c77415a
commit ff5acea1a0

View file

@ -3,7 +3,7 @@ import os, re, http.client, sys, stat, urllib.parse, time, socket, xml.sax
from urllib.parse import quote from urllib.parse import quote
from io import StringIO from io import StringIO
from mimetypes import guess_type from mimetypes import guess_type
from base64 import encodestring from base64 import encodebytes
from appy import Object from appy import Object
from appy.shared.utils import copyData, sequenceTypes from appy.shared.utils import copyData, sequenceTypes
from appy.shared.xml_parser import XmlUnmarshaller, XmlMarshaller from appy.shared.xml_parser import XmlUnmarshaller, XmlMarshaller
@ -161,7 +161,7 @@ class Resource:
if 'Authorization' in headers: return if 'Authorization' in headers: return
credentials = '%s:%s' % (self.username, self.password) credentials = '%s:%s' % (self.username, self.password)
credentials = credentials.replace('\012', '') credentials = credentials.replace('\012', '')
headers['Authorization'] = "Basic %s" % encodestring(credentials) headers['Authorization'] = "Basic %s" % encodebytes(credentials)
headers['User-Agent'] = 'Appy' headers['User-Agent'] = 'Appy'
headers['Host'] = self.host headers['Host'] = self.host
headers['Connection'] = 'close' headers['Connection'] = 'close'