docker-offlineimap/offlineimap
Thomas De Schampheleire 78807b55b4 imapserver.py: fix __xoauth2handler in Python 3
Error when using the XOAUTH2 token refresh logic:

  ("POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. (configuration is: {....}", <traceback object at 0x7fc6e69f2b40>)
     ['  File ".../offlineimap3/offlineimap/accounts.py", line 298, in syncrunner
        self.__sync()
    ', '  File ".../offlineimap3/offlineimap/accounts.py", line 374, in __sync
        remoterepos.getfolders()
    ', '  File ".../offlineimap3/offlineimap/repository/IMAP.py", line 446, in getfolders
        imapobj = self.imapserver.acquireconnection()
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 579, in acquireconnection
        self.__authn_helper(imapobj)
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 443, in __authn_helper
        if func(imapobj):
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 377, in __authn_xoauth2
        imapobj.authenticate(\'XOAUTH2\', self.__xoauth2handler)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 681, in authenticate
        typ, dat = self._simple_command(\'AUTHENTICATE\', mechanism.upper())
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 1674, in _simple_command
        return self._command_complete(self._command(name, *args), kw)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 1394, in _command
        literal = literator(data, rqb)
    ', '  File ".../offlineimap3/venv/lib/python3.7/site-packages/imaplib2.py", line 2237, in process
        ret = self.mech(self.decode(data))
    ', '  File ".../offlineimap3/offlineimap/imapserver.py", line 253, in __xoauth2handler
        raise type(e)(msg, exc_info()[2])
    ']

Fix by encoding the data passed to urllib.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
2020-09-29 10:04:07 +02:00
..
folder Remove md5 import 2020-09-03 21:36:09 +02:00
repository repository/__init__.py remove try import python2 2020-09-03 21:36:10 +02:00
ui ui/UIBase.py do not use builtin object as variable 2020-08-30 18:12:17 +02:00
utils utils/const.py Removed extra characters 2020-08-30 18:14:15 +02:00
__init__.py Reformat offlineimap/__init__.py 2020-08-29 20:04:40 +02:00
accounts.py offlineimap/accounts added Exception with lock file 2020-09-03 21:36:08 +02:00
CustomConfig.py six: changed offlineimap/CustomConfig.py 2020-09-03 21:35:54 +02:00
emailutil.py emailutil.py updated docstrings 2020-08-30 18:21:00 +02:00
error.py Reformat offlineimap/error.py 2020-08-29 20:15:55 +02:00
globals.py Reformat offlineimap/globals.py 2020-08-29 20:16:35 +02:00
imaplibutil.py six: changed offlineimap/imaplibutil.py 2020-09-03 21:36:02 +02:00
imapserver.py imapserver.py: fix __xoauth2handler in Python 3 2020-09-29 10:04:07 +02:00
imaputil.py imaputil.py split the if 2020-08-30 18:43:22 +02:00
init.py removed virtual_imaplib2 2020-08-31 16:24:26 +02:00
localeval.py localeval.py removed extra parenthesys 2020-08-30 18:52:56 +02:00
mbnames.py mbnames.py removed extra parenthesys 2020-08-30 18:53:02 +02:00
threadutil.py threadutil.py removed extra parenthesys 2020-08-30 18:54:52 +02:00