Skip to content

Commit

Permalink
Update IMAP.py
Browse files Browse the repository at this point in the history
Add default parameter to getpassword()
Add docstring to getpassword() about using keyring.
  • Loading branch information
chris001 authored and catap committed Nov 18, 2023
1 parent d99b2f7 commit 6842651
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions offlineimap/repository/IMAP.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def getexpunge(self):
"""
return self.getconfboolean('expunge', True)

def getpassword(self, ignore_keyring):
def getpassword(self, ignore_keyring=False):
"""Return the IMAP password for this repository.
It tries to get passwords in the following order:
Expand All @@ -578,6 +578,7 @@ def getpassword(self, ignore_keyring):
3. read password from file specified in Repository 'remotepassfile'
4. read password from ~/.netrc
5. read password from /etc/netrc
6. read password from keyring
On success we return the password.
If all strategies fail we return None."""
Expand Down Expand Up @@ -651,7 +652,7 @@ def getpassword(self, ignore_keyring):
if user is None or user == netrcentry[0]:
return netrcentry[2]

# 5. Read from keyring as the last option
# 6. Read password from keyring as the last option
if not ignore_keyring:
return keyring.get_password(self.gethost(), self.getuser())
return None
Expand Down

0 comments on commit 6842651

Please sign in to comment.