pycarddav icon indicating copy to clipboard operation
pycarddav copied to clipboard

A few improvements when integrating with DavMail

Open mistotebe opened this issue 11 years ago • 5 comments
trafficstars

First commit allows using proxies natively. Second actually sends a valid request when PROPFINDing the addressbook data.

mistotebe avatar Oct 10 '14 15:10 mistotebe

The issue with PROPFIND is likely fixed with #92.

untitaker avatar Oct 10 '14 16:10 untitaker

You can achieve proxy support by setting environment variables: http://docs.python-requests.org/en/latest/user/advanced/?highlight=proxy#proxies

But i am not sure why you'd need proxy support for DavMail. I ran it locally and just had to point the client against a local URL.

untitaker avatar Oct 10 '14 16:10 untitaker

The proxy support was helpful when trying to find out what was going wrong, going through an intercepting proxy like mitmproxy, but I believe it is useful nevertheless, which is why I included it here.

By issue #92, do you mean pycarddav being replaced by vdirsyncer? At the moment, I also use pycarddav as a library, is there a way to do that with vdirsyncer?

mistotebe avatar Oct 10 '14 23:10 mistotebe

By issue #92, do you mean pycarddav being replaced by vdirsyncer?

Not really. Vdirsyncer is just the synchronization part. It stores contacts e.g. in a directory of .vcf files. There are already a few apps with functionality equivalent to pycarddav: https://vdirsyncer.readthedocs.org/en/latest/supported.html#client-applications

At the moment, I also use pycarddav as a library, is there a way to do that with vdirsyncer?

You can use vdirsyncer as a library, but as it's not an exact replacement, you'll have to see if the particular feature implementation you want to use is actually within its scope. I suppose you want to take a look at the CarddavStorage class in https://github.com/untitaker/vdirsyncer/blob/master/vdirsyncer/storage/dav.py

untitaker avatar Oct 11 '14 05:10 untitaker

Hi, sorry for not getting back to you on this sooner.

First let me thank you for this pull request: thanks!

Second, it does not currently work for me, I get this error:

Traceback (most recent call last):
  File "/home/cg/.virtualenvs/khal/bin/pycardsyncer", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/cg/workspace/pycarddav/bin/pycardsyncer", line 55, in <module>
    sync(conf)
  File "/home/cg/workspace/pycarddav/pycarddav/controllers/sync.py", line 50, in sync
    abook = syncer.get_abook()  # type(abook): dict
  File "/home/cg/workspace/pycarddav/pycarddav/carddav.py", line 134, in get_abook
    abook = self._process_xml_props(xml)
  File "/home/cg/workspace/pycarddav/pycarddav/carddav.py", line 278, in _process_xml_props
    props.text.split(';')[0].strip() in ['text/vcard', 'text/x-vcard']):
AttributeError: 'NoneType' object has no attribute 'split'

If you fix this, I'll merge this PR.

geier avatar Dec 02 '14 23:12 geier