mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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):
|
def prepare_auth(auth, username, password):
|
||||||
if (username and password) or auth == 'basic':
|
if auth == 'basic':
|
||||||
return (username, password)
|
return (username, password)
|
||||||
elif auth == 'digest':
|
elif auth == 'digest':
|
||||||
from requests.auth import HTTPDigestAuth
|
from requests.auth import HTTPDigestAuth
|
||||||
return HTTPDigestAuth(username, password)
|
return HTTPDigestAuth(username, password)
|
||||||
elif auth is None:
|
elif auth is None:
|
||||||
|
if username and password:
|
||||||
|
return (username, password)
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
raise ValueError('Unknown authentication method: {}'.format(auth))
|
raise ValueError('Unknown authentication method: {}'.format(auth))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue