mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-31 09:55:55 +00:00
Fix a bug where only basic auth would work
This commit is contained in:
parent
5c6806ce97
commit
29405f59ef
1 changed files with 3 additions and 1 deletions
|
|
@ -15,12 +15,14 @@ USERAGENT = 'vdirsyncer'
|
|||
|
||||
|
||||
def prepare_auth(auth, username, password):
|
||||
if (username and password) or auth == 'basic':
|
||||
if auth == 'basic':
|
||||
return (username, password)
|
||||
elif auth == 'digest':
|
||||
from requests.auth import HTTPDigestAuth
|
||||
return HTTPDigestAuth(username, password)
|
||||
elif auth is None:
|
||||
if username and password:
|
||||
return (username, password)
|
||||
return None
|
||||
else:
|
||||
raise ValueError('Unknown authentication method: {}'.format(auth))
|
||||
|
|
|
|||
Loading…
Reference in a new issue