Offlineimap: python code to read refresh token from unix pass (or gpg file)
-1
votes
1
answer
217
views
I use offlineimap to organize my emails, and in order to use my work account I am now obliged to use OAuth2 authentication.
I successfully got a refresh-token, and thus offlineimap works if I set the variable
accordingly. However, I would like to store the refresh token encrypted (I use unix pass, that stores it as a gpg encrypted file).
I cannot manage to use the
to set a python code that reads the refresh token from pass, or the corresponding gpg file, probably because of my complete lack of python knowledge. I tried to use the same code as for
(and that for the latter works perfectly):
def get_pass(account):
return check_output("pass email/" + account, shell=True).splitlines()
but I get the following error:
TypeError: a bytes-like object is required, not 'str'
and in fact the offlineimaprc template here specifies that the returned values by
"must be bytes" (whatever this means).
What is the correct code to use in this case?
Asked by yuggib
(101 rep)
Feb 11, 2022, 12:02 AM
Last activity: Mar 6, 2022, 08:40 PM
Last activity: Mar 6, 2022, 08:40 PM