Giter Club home page Giter Club logo

calendar-cli's People

Contributors

bug avatar dotlambda avatar fauxmight avatar fgtham avatar mkapra avatar phavekes avatar tobixen avatar ymitsos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calendar-cli's Issues

Python3-compatibility

When calendar-cli was created, the caldav-library only existed in python2-version, and it was further dependent on vobject, which also only existed in python2-version. Those obstacles have been solved now. "python2" is still hardcoded in the script though.

Even though "python2" is hardcoded in the script, when the script is installed through setup.py using python3, running the installed "calendar-cli" may invoke python3. The script has not been thoroughly tested under python3. It's needed to do quite some testing.

One bug spotted so far, run the script without any parameters, and argparse will print out a nice error message and user instructions when parser.parse_args is run on line 838 and exit. Under python3 this does not happen, and instead we get an ugly error on line 836 as func is undefined.

date_search() got an unexpected keyword argument 'expand'

Topic:

Traceback (most recent call last):
  File "calendar-cli.py", line 937, in <module>
    main()
  File "calendar-cli.py", line 934, in main
    ret = args.func(caldav_conn, args)
  File "calendar-cli.py", line 480, in calendar_agenda
    events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend, expand=True)
TypeError: date_search() got an unexpected keyword argument 'expand'

anything else I can provide? Python 2.7.17.

%F fails on Windows

I just noticed that the default date format %F fails on Windows,
tested with Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32) and calendar-cli.py with __version__ = "0.11.0".

I replaced %F with its equivalent %Y-%m-%d on lines 797 and 847 and confirmed it works.
Hope this would be helpful. Thanks.

URL method is encoding % character from find_calendar_url

I'm trying to run this against davmail but ran into a 503 error. turning on debug showed me this output after trying to PUT the ics:

ErrorNonExistentMailbox The SMTP address has no mailbox associated with it.

Taking a closer look and it seems to be the URL being put has had the % of the %40 (@) symbol encoded again resulting in something like this:

url from find_calendar_url():

/users/ianmorti%40cisco.com/calendar/AAMkADY5Yzk2YzY2LTM3YjgtNGU3MS04ZjJhLWE0OTA5OTA2YzMzMABGAAAAAABaZbS1qzoCRbWKnukDytwmBwAAfSH2WrdKSZ6O8gsQ94_mAAAAIktDAAAlhWHjXhoFTaJrSjqq9TpRAAAPvJBbAAA%3D.EML/

url after passing through URL() from caldavclientlibrary in _calendar_addics():
URL: /users/ianmorti%2540cisco.com/calendar/AAMkADY5Yzk2YzY2LTM3YjgtNGU3MS04ZjJhLWE0OTA5OTA2YzMzMABGAAAAAABaZbS1qzoCRbWKnukDytwmBwAAfSH2WrdKSZ6O8gsQ94_mAAAAIktDAAAlhWHjXhoFTaJrSjqq9TpRAAAPvJBbAAA%253D.EML/1049a928-5d33-11e3-bbfd-90b11c66433d.ics

note the %2540 in my email address.

Package repository

Will this tool be installable via pip? Right now I am struggeling with manually installing the dependencies, as some of them are not found by pip.

--event-template is poorly documented and tested

Sorry I use a translator (Deepl.com)

hello,
First of all, thanks for calendar-cli, it's really great.
I would like to know if there would be (or if there is already) the possibility to add a description and the place to the agenda?
I use descriptions a lot in calendar events and that would be really useful for me.
Thanks in advance for your help.

Date_search expand

Hi,
Excuse-me for my bad english. Thank you very much for your soft which is exactly I search.
I had a problem when I tried the following line : calendar-cli.py calendar agenda --from-time=2016-05-17 --agenda-days=14.
Error was :
File "/usr/local/bin/calendarcmd", line 480, in calendar_agenda events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend, expand=True) TypeError: date_search() got an unexpected keyword argument 'expand'
I removed ", expand=True" at line 480 and the error disappeared and all worked out.
But, is it correct to do so ?
Thank you again for your work. Have a nice day. Vincent

Select todo ID for editing

Hi,
very interesting project.

I need little help.
How can I get the ID or what is necessary of a specific todo item to edit this one?

ImportError: No module named tzlocal

When I try to start calendar-cli on Linux Mint 17 Qiana, I get the error "ImportError: No module named tzlocal".
I can fix this with "sudo pip install tzlocal", but I think the error should not happen at all.
Having fixed the error, I run into the next error "ImportError: No module named icalendar".
I can fix that with "sudo pip install icalendar", but most people would probably have given up there already. Having fixed that error, I run into the next error "ImportError: No module named caldav", which makes me think about trying khal instead. I was able to fix the error with "sudo pip install caldav", though.

Feature: semi-automatic calendar synchronization

Purpose: sync relevant events i.e. between private and work calendars.

I.e. syncing from the work calendar to private calender:

  • One sets up a filter (i.e. monday-friday, 09-17 - plus a fuzz-factor of one hour - so everything between 16:00 and 10:00 should be listed out when syncing to the private calendar, and everything between 08:00 and 18:00 should be listed when syncing the other way).

  • All events outside the time filter should be listed out from the work calendar

  • All of those events that are already referred from the private calendar should be excluded

  • Remaining events gets listed in a temp text file. Every line is prefixed with "A" for add.

  • calendar-cli opens $EDITOR and allows the user to edit the temp text file

  • file contains user instructions

  • user deletes stuff that shouldn't be synced (or better: mark it up, so the next sync won't ask for it)

  • some stuff should be synced, but without confidential details. system should allow for this.

  • events are stuffed into the private calendar.

  • user may do the reverse for syncing from the private calendar to the work calendar.

    or outside (vice-verse) the time interval (plus/minus some margins - say one hour overlapping) will be listed out. The into a text file.

KeyError: 'default' in File "./bin/calendar-cli.py", line 500, in config_section

>./bin/calendar-cli.py  -h
Traceback (most recent call last):
  File "./bin/calendar-cli.py", line 665, in <module>
    main()
  File "./bin/calendar-cli.py", line 552, in main
    defaults = config_section(config, args.config_section)
  File "./bin/calendar-cli.py", line 500, in config_section
    if 'inherits' in config[section]:
KeyError: 'default'

Not really an issue, but a comment

Firstly, thank you for developing this. I have been looking for a good cli calendar replacement since I quit using Google Calendar.

  1. I have the script working and can add events to my calendar which is hosted at fruux.com.
    Adding an event by typing in the really long calendar URL is a bit cumbersome, is it possible to set a default calendar url and a default task url in the config file?
  2. In my config file I set the timezone to my local time, Europe/Stockholm. How do I add times to new events? It seems that my events always end up as being from 02.00.

missing dependency on requests

something's weird after a pip install --upgrade 'git+https://github.com/tobixen/calendar-cli#egg=calendar-cli':

>./bin/calendar-cli.py  -h
Traceback (most recent call last):
  File "./bin/calendar-cli.py", line 12, in <module>
    import caldav
  File "/tmp/radicale/local/lib/python2.7/site-packages/caldav/__init__.py", line 3, in <module>
    from .davclient import DAVClient
  File "/tmp/radicale/local/lib/python2.7/site-packages/caldav/davclient.py", line 4, in <module>
    import requests
ImportError: No module named requests

I have the feeling it's not necessarily calendar-cli's fault, so the bug might need to be propagated.
In any case, the ".py" suffix could be gotten rid of...

Example given in README.md does not work

$ ./calendar-cli.py calendar --calendar-url=http://calendar.bekkenstenveien53c.oslo.no/caldav.php/tobias/calendar/ add 2013-10-01 testevent
usage: calendar-cli [-h] [--config-file FILE] [--config-section CONFIG_SECTION] [--interactive-config] [--version] [--nocaldav] [--icalendar] [--timezone TIMEZONE] [--language LANGUAGE] [--caldav-url URL] [--caldav-user USER] [--caldav-pass PASS] [--debug-logging] [--calendar-url CALENDAR_URL] {todo,calendar} ...
calendar-cli: error: unrecognized arguments: --calendar-url=http://calendar.bekkenstenveien53c.oslo.no/caldav.php/tobias/calendar/

edit: moving the --calendar-url before the calendar command in the command-line fixes this. It might be a bug in argparse (I already had issues with global/local options and different behavior with different versions of argparse).

calendar-cli.py does not like Umlauts

I get errors whenever my new task contains a German Umlaut:

$ calendar-cli.py todo add den Ingeniör ist nichts zu schwör
Traceback (most recent call last):
File "/usr/bin/calendar-cli.py", line 866, in
main()
File "/usr/bin/calendar-cli.py", line 863, in main
ret = args.func(caldav_conn, args)
File "/usr/bin/calendar-cli.py", line 414, in todo_add
_calendar_addics(caldav_conn, cal.to_ical(), uid, args)
File "/usr/bin/calendar-cli.py", line 143, in _calendar_addics
c.add_event(ics)
File "/usr/local/lib/python2.7/dist-packages/caldav/objects.py", line 422, in add_event
return Event(self.client, data = ical, parent = self).save()
File "/usr/local/lib/python2.7/dist-packages/caldav/objects.py", line 718, in save
self._create(self._instance.serialize(), self.id, path)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 255, in serialize
return behavior.serialize(self, buf, lineLength, validate)
File "/usr/local/lib/python2.7/dist-packages/vobject/behavior.py", line 162, in serialize
out = base.defaultSerialize(transformed, buf, lineLength)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 993, in defaultSerialize
child.serialize(outbuf, lineLength, validate=False)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 255, in serialize
return behavior.serialize(self, buf, lineLength, validate)
File "/usr/local/lib/python2.7/dist-packages/vobject/behavior.py", line 162, in serialize
out = base.defaultSerialize(transformed, buf, lineLength)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 993, in defaultSerialize
child.serialize(outbuf, lineLength, validate=False)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 255, in serialize
return behavior.serialize(self, buf, lineLength, validate)
File "/usr/local/lib/python2.7/dist-packages/vobject/behavior.py", line 162, in serialize
out = base.defaultSerialize(transformed, buf, lineLength)
File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 1015, in defaultSerialize
foldOneLine(outbuf, s.getvalue(), lineLength)
File "/usr/lib/python2.7/StringIO.py", line 271, in getvalue
self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)

Crash for older start time etc.

Hi,

I highly appretiate your project, since a command line interface to CalDav is urgently needed.

Unfortunately calendar-cli.py keeps crashing for many operations, e.g.:

  • "calendar-cli.py calendar agenda --from-time 2017-04-01 --to-time 2017-07-01" works,
    but changing from-time to 2017-03-01 yields a crash:

Traceback (most recent call last):
File "/usr/local/bin/calendar-cli.py", line 866, in
main()
File "/usr/local/bin/calendar-cli.py", line 863, in main
ret = args.func(caldav_conn, args)
File "/usr/local/bin/calendar-cli.py", line 436, in calendar_agenda
events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend)
File "/usr/lib/python2.7/site-packages/caldav/objects.py", line 510, in date_search
Event(self.client, url=self.url.join(r), data=results[r][cdav.CalendarData.tag], parent=self))
File "/usr/lib/python2.7/site-packages/caldav/objects.py", line 724, in init
self.data = data
File "/usr/lib/python2.7/site-packages/caldav/objects.py", line 801, in _set_data
self._instance = vobject.readOne(to_unicode(self._data))
File "/usr/lib/python2.7/site-packages/vobject/base.py", line 1153, in readOne
allowQP))
File "/usr/lib/python2.7/site-packages/vobject/base.py", line 1125, in readComponents
component.transformChildrenToNative()
File "/usr/lib/python2.7/site-packages/vobject/base.py", line 674, in transformChildrenToNative
child.transformChildrenToNative()
File "/usr/lib/python2.7/site-packages/vobject/base.py", line 673, in transformChildrenToNative
child = child.transformToNative()
File "/usr/lib/python2.7/site-packages/vobject/base.py", line 185, in transformToNative
return self.behavior.transformToNative(self)
File "/usr/lib/python2.7/site-packages/vobject/icalendar.py", line 1386, in transformToNative
raise ParseError("DURATION must have a single duration string.")
vobject.base.ParseError: At line 9: DURATION must have a single duration string.

  • also a simple "calendar-cli.py calendar agenda" yields:

Traceback (most recent call last):
File "/usr/local/bin/calendar-cli.py", line 866, in
main()
File "/usr/local/bin/calendar-cli.py", line 863, in main
ret = args.func(caldav_conn, args)
File "/usr/local/bin/calendar-cli.py", line 436, in calendar_agenda
events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend)
File "/usr/lib/python2.7/site-packages/caldav/objects.py", line 507, in date_search
results = self._handle_prop_response(response=response, props=[cdav.CalendarData()])
File "/usr/lib/python2.7/site-packages/caldav/objects.py", line 145, in _handle_prop_response
for r in response.tree.findall('.//' + dav.Response.tag):
AttributeError: 'NoneType' object has no attribute 'findall'

My .config looks like:

{
"default": {
"caldav_url": "http://my-davical/caldav.php/",
"calendar_url": "my/calendar",
"caldav_user": "my",
"caldav_pass": "XXXXXX"
},
"all": {
"caldav_url": "http://my-davical/caldav.php/",
"calendar_url": "all/calendar",
"caldav_user": "all",
"caldav_pass": "XXXXXX"
}
}

Evolution and Lightning display proper calendar entries for both sections.

To be honest, nearly every invocation of calendar-cli.py crashes for me.
I am running Python 2.7.12 on an OpenSuSE 42.1.

What would be my mistake?
Is there a chance to catch errors before Python starts it's error handling?

Best regards

T. Finke

Delete by date

Hi,
I haven't found how delete an event. At the end of your code, I found arguments --event-uid, -url and -timestamp. I try uid and it works fine. But, with -timestamp, not. Is there a little documentation for the format of timestamp or is it evident ? It's certainly not a criticism, just a question.
Thank you. Vincent
(My english is poor. In frech, I know that words are important to say I only search to use a work I appreciate, but in english, i don't know how to say that.)

List iCloud todo fails

I just noticed that listing my iCloud's todo list fails with the following error:

$ ./calendar-cli.py —config-section shopping list todo list
Traceback (most recent call last):
  File "/Users/manfred/src/calendar-cli/calendar-cli.py", line 798, in <module>
    main()
  File "/Users/manfred/src/calendar-cli/calendar-cli.py", line 795, in main
    ret = args.func(caldav_conn, args)
  File "/Users/manfred/src/calendar-cli/calendar-cli.py", line 533, in todo_list
    tasks = todo_select(caldav_conn, args)
  File "/Users/manfred/src/calendar-cli/calendar-cli.py", line 430, in todo_select
    tasks = find_calendar(caldav_conn, args).todos()
  File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 551, in todos
    response = self._query(root, 1, 'report')
  File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 123, in _query
    raise error.exception_by_method[query_method](errmsg(ret))
caldav.lib.error.ReportError: 500 Internal Server Error

Adding items to the same list works fine, though:

$ ./calendar-cli.py --config-section shoppinglist todo add Tomatoes
Added todo item with uid=57a031c2-865b-11e5-8b6b-14109ff07266

Kolab Now not working

I wanted to try out calendar-cli, which looks very promising. Yet I cannot get it to work with my CalDav calendars in Kolab Now. I use them successfully with DavDroid, Evolution and Thunderbird, so I think this ought to work as well.

Kolab has a variety of endpoints to use, as also documented: https://kolabnow.com/clients/others#carddav-and-caldav-settings

  • https://apps.kolabnow.com
  • https://apps.kolabnow.com/calendars
  • https://apps.kolabnow.com/calendars/<account_mail_address>
  • https://apps.kolabnow.com/calendars/<account_mail_address>/<unique_id_per_calendar>

When I try to connect, I get returned an error: Exception: The CalDAV server you are using has a problem with path handling.
If I fail to provide a password I get a caldav.lib.error.AuthorizationError: ... reason 'Unauthorized' error, so it seems it is failing at some of the latter stages.
I tried both the calendar and task lists.

I could not easily search in the bitbucket code of the underlying library. Is that the one I should be looking into to resolve this issue? Are there ways in which I can debug this issue?

Feature: calendar-name option

Today one should enter a calendar-url to chose an alternative calendar - that's not much user friendly, even if relative URLs are allowed. Search by calendar name is trivial. We should have a --calendar-name option.

Sabre exception when querying Owncloud calendar

I'm trying to read a calendar from a local server running Owncloud. The client system is Xubuntu 15.10, the server is Ubuntu 14.04 with Owncloud 8.1.4. I assume that's what the 'agenda' subcommand is supposed to do.

$ ./calendar-cli.py calendar agenda
Traceback (most recent call last):
  File "./calendar-cli.py", line 665, in <module>
    main()
  File "./calendar-cli.py", line 662, in main
    ret = args.func(caldav_conn, args)
  File "./calendar-cli.py", line 328, in calendar_agenda
    events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend)
  File "/usr/local/lib/python2.7/dist-packages/caldav/objects.py", line 491, in date_search
    response = self._query(root, 1, 'report')
  File "/usr/local/lib/python2.7/dist-packages/caldav/objects.py", line 120, in _query
    raise error.exception_by_method[query_method](ret.raw)
caldav.lib.error.ReportError: <?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:sabredav-version>2.1.6</s:sabredav-version>
  <s:exception>Sabre\VObject\EofException</s:exception>
  <s:message>End of document reached prematurely</s:message>
</d:error>

Printing the todo list seems to work:

 ./calendar-cli.py todo list
2015-11-05! 2016-11-04  Test 1 2 3 4

Adding items to the calendar also works. It's just the reading that doesn't work.

I am not sure what to make of this. Other CalDAV clients like the CalDAV sync adapter for Android or Mozilla Thunderbird with the Lightning plugin work just fine.

Improve support for full-day-events

Hello, I have a quick question,
Is it possible to add a "full day" event? I am not talking about a 24-hour event, I do not know if I am clear...
Event Full Day :

Event 24h (23h59) :

Due dates and duration

This is a follow-up of #63, to be fixed "properly" in some upcoming 1.0-release, possibly with some work-arounds in 0.12 or 0.13.

As of 0.11, todo items with no due date set will be shown with a due date (calcualated out from a hard coded default duration). If no due date is given when creating a vtodo item, the due date is set through a hard-coded default duration. Further, handling of the DURATION field in the vtodo when listing tasks is probably broken.

While the hard coded default did make sense in my specific use case back then, it does not make sense to have this hard-coded, and probably the most logical action would be not to show any due-date if neither due-date nor duration is given in the task, and also not to set any due date if nothing is given when creating the task. For users who wants to keep default duration when listing and/or creating tasks, it should be possible to specify this in the config file.

0.12 and (if there will be any) 0.13 should be backward-compatible with 0.11, hence the user has to be explicit either in the command line options or in the configuration to avoid default due dates in future 0.x-releases.

Interactive Mode: caldav_pass

I would use the module getpass to get the users password.
With this method the password is not echoed to the terminal.

Caldav-Request does not support SNI

When I try to fetch my calendar, I get the following error:
[...]
File "/usr/local/lib/python2.7/dist-packages/caldav/davclient.py", line 127, in propfind
return self.request(url or self.url, "PROPFIND", props, {'Depth': str(depth)})
File "/usr/local/lib/python2.7/dist-packages/caldav/davclient.py", line 227, in request
r = requests.request(method, url, data=to_wire(body), headers=combined_headers, proxies=proxies, auth=auth, verify=self.ssl_verify_cert)
[...]
requests.exceptions.SSLError: hostname 'XXXXXX' doesn't match 'YYYYYY'

My server has a valid certificate when the client requests it via SNI. What can I do to get this working? Is there some option to turn off cert verification as a workaround?

License is missing

Hi,

I couldn't find any information regarding the license your program is under - some might not be able to use your software until this is resolved.

Personally, I'd recommend an ISC-style license.

Regards,

Raf

python3: calendar-cli without options returns weird error rather than help

Ref #33, python2 is sunset now.

Apparently the subcommand stuff in argparse differs in python3

$ python2 ./calendar-cli 
usage: calendar-cli [-h] [--config-file FILE]
                    [--config-section CONFIG_SECTION] [--interactive-config]
                    [--version] [--nocaldav] [--icalendar]
                    [--timezone TIMEZONE] [--language LANGUAGE]
                    [--caldav-url URL] [--caldav-user USER]
                    [--caldav-pass PASS] [--caldav-proxy CALDAV_PROXY]
                    [--ssl-verify-cert SSL_VERIFY_CERT] [--debug-logging]
                    [--calendar-url CALENDAR_URL] [--ignoremethod]
                    {todo,journal,calendar} ...
calendar-cli: error: too few arguments

$ python3 ./calendar-cli
Traceback (most recent call last):
  File "./calendar-cli", line 925, in <module>
    main()
  File "./calendar-cli", line 922, in main
    ret = args.func(caldav_conn, args)
AttributeError: 'Namespace' object has no attribute 'func'

Add todo without due

Is there a way to add items to a todo list without setting a due date?
I'm adding items to a shopping list which obv dont need a due date.

cannot connect to the radicale calendar

Hi,

after installing i have problem to connect to the my own radicale calendar server (served via Nginx -> uWSGI -> Radicale), which i am using for some years with vdirsyncer and thunderbird + lightning:

Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 392, in todo_select
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 84, in find_calendar
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 307, in __init__
    cup = self.get_properties([dav.CurrentUserPrincipal()])
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 172, in get_properties
    response = self._query_properties(props, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 99, in _query_properties
    return self._query(root, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 114, in _query
    url, body, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/davclient.py", line 127, in propfind
    return self.request(url or self.url, "PROPFIND", props, {'Depth': str(depth)})
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/davclient.py", line 242, in request
    raise ex
caldav.lib.error.AuthorizationError: AuthorizationError at 'https://calend.slavino.sk/slavko/hlavny.ics/', reason 'Unauthorized'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/calendar-cli.py", line 4, in <module>
    __import__('pkg_resources').run_script('calendar-cli==0.0.0', 'calendar-cli.py')
  File "/usr/lib64/python3.4/site-packages/pkg_resources/__init__.py", line 726, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib64/python3.4/site-packages/pkg_resources/__init__.py", line 1491, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 687, in <module>
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 684, in main
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 475, in todo_list
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 394, in todo_select
  File "/usr/lib64/python3.4/site-packages/calendar_cli-0.0.0-py3.4.egg/EGG-INFO/scripts/calendar-cli.py", line 84, in find_calendar
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 307, in __init__
    cup = self.get_properties([dav.CurrentUserPrincipal()])
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 172, in get_properties
    response = self._query_properties(props, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 99, in _query_properties
    return self._query(root, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/objects.py", line 114, in _query
    url, body, depth)
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/davclient.py", line 127, in propfind
    return self.request(url or self.url, "PROPFIND", props, {'Depth': str(depth)})
  File "/usr/lib64/python3.4/site-packages/caldav-0.4.0-py3.4.egg/caldav/davclient.py", line 242, in request
    raise ex
caldav.lib.error.AuthorizationError: AuthorizationError at 'https://calend.slavino.sk/slavko/hlavny.ics/', reason 'Unauthorized'

The connection is forced to https and the TLS handshake seems to be completed (i am not expert, but i see no problem in wireshark). I have HTTP Basic auth in nginx, which works with vdirsyncer (from nginx's log):

192.168.0.1 - name [04/Apr/2016:20:00:01 +0200] "PROPFIND /name/calendar.ics/ HTTP/1.1" 207 6243 "-" "vdirsyncer"

but doesn't work with calendar-cli (always two requests by one command):

192.168.0.1 - - [04/Apr/2016:20:32:07 +0200] "PROPFIND /name/calendar.ics/ HTTP/1.1" 401 0 "-" "Mozilla/5.0"
192.168.0.1 - - [04/Apr/2016:20:32:07 +0200] "PROPFIND /name/calendar.ics/ HTTP/1.1" 401 0 "-" "Mozilla/5.0"

I am not able to debug the HTTP due TLS...

The config file contains (name and password removed):

{ "default": 
    { "caldav_url": "https://myserver.name/name/calendar.ics/",
        "caldav-user": "name",
        "caldav-pass": "passwd"
    }
}

The credentials are OK, because i copy them from vdirsyncer's config and then retype them again. My knowledge ends here :-(

--interactive crashes the program

Traceback (most recent call last):
  File "calendar-cli.py", line 904, in <module>
    main()
  File "calendar-cli.py", line 772, in main
    parser.set_defaults(**defaults)
UnboundLocalError: local variable 'defaults' referenced before assignment

python3: byte-objects are printed to stdout

Also ref #33

When calendar-cli is run with python3 rather than python2, the printout from calendar todo list looks quite bad now ... like b'description of task' instead of just description of task.

Odd interaction with DAViCal

I'm running a DAViCal server in which my user account has multiple associated calendars (specifically, "teaching", "research", and "administrative"). When I use calendar-cli to create a TODO and provide the URL of any calendar, the item is added to the research calendar. I would assume this to be a bug in DAViCal, but both my Android calendar sync client (DAV Droid) and my laptop's client (Thunderbird Lightning) have no trouble adding tasks to specific calendars.

I've checked the configuration parsing and calendar-cli is indeed passing the right URL to the underlying calendar library, but I thought I'd file this issue so that it's know that it exists (even if the problem turns out to be an underlying dependency instead of some way that calendar-cli is using it).

Ugly AssertationError without config

When installing and just calling calendar-cli without any configuration added, an AssertationError is thrown.
For a better user experience, display a warning about the missing configuration.

Traceback (most recent call last):
  File "/usr/bin/calendar-cli", line 4, in <module>
    __import__('pkg_resources').run_script('calendar-cli==0.0.0', 'calendar-cli')
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python3.7/site-packages/calendar_cli-0.0.0-py3.7.egg/EGG-INFO/scripts/calendar-cli", line 911, in <module>
  File "/usr/lib/python3.7/site-packages/calendar_cli-0.0.0-py3.7.egg/EGG-INFO/scripts/calendar-cli", line 901, in main
  File "/usr/lib/python3.7/site-packages/calendar_cli-0.0.0-py3.7.egg/EGG-INFO/scripts/calendar-cli", line 118, in caldav_connect
  File "/usr/lib/python3.7/site-packages/caldav-0.6.1-py3.7.egg/caldav/davclient.py", line 96, in __init__
    if self.url.username is not None:
AttributeError: 'NoneType' object has no attribute 'username'

Add reminder to event

Hi, and thanks for this nice little tool. Very Handy to use inside scripts to automatically add events !

There is one killer feature that I miss very much: the possibility to add a reminder to the event. Have I missed this one ?

Checking for conflicts before adding an event.

Hello,
it seems (at least on my setup) that I can add an event two times without any raised issue (with SOGo 3.2.7). Would it be possible to have an option to check for conflicts and return an error message/code in that case?

Bug: timezone issues when adding events on a date

  • When adding an event (or todo) with a date and no time, it will end up in the calendar at 00:00 UTC, and not local time. Should ensure that the time zone gets correct.
  • Need to ensure that events without time gets right in the test script
  • Need to ensure that the application is able to handle time zones in the test script

RFC4791 and METHOD property

Hi,

I receive frequently calendar invitations that include a METHOD property. According to RFC4791, paragraph 4.1 this must not happen, if I understand correctly.

The latter causes an exception like this:

aceback (most recent call last):
  File "./calendar-cli.py", line 866, in <module>
    main()
  File "./calendar-cli.py", line 863, in main
    ret = args.func(caldav_conn, args)
  File "./calendar-cli.py", line 183, in calendar_addics
    _calendar_addics(caldav_conn, c.to_ical(), uid, args)
  File "./calendar-cli.py", line 143, in _calendar_addics
    c.add_event(ics)
  File "~/.virtualenvs/calendar-cli/lib/python2.7/site-packages/caldav/objects.py", line 422, in add_event
    return Event(self.client, data = ical, parent = self).save()
  File "~/.virtualenvs/calendar-cli/lib/python2.7/site-packages/caldav/objects.py", line 718, in save
    self._create(self._instance.serialize(), self.id, path)
  File "~/.virtualenvs/calendar-cli/lib/python2.7/site-packages/caldav/objects.py", line 704, in _create
    raise error.PutError(r.raw)
caldav.lib.error.PutError: <?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\UnsupportedMediaType</s:exception>
  <s:message>Validation error in iCalendar: A calendar object on a CalDAV server MUST NOT have a METHOD property.</s:message>
</d:error>

Would you consider handling this exception and selectively ignoring it for this use-case?

calendar-cli on PyPi

There is a calendar-cli on the PyPi, it seems as related (gcalendar), but not the same apps and this can be confusing for the users (include me, for while). IMO will be good at least to mention it in README, to prevent confusing, or ,if you are willing, to rename the project.

Time stamp in events

Hi, I recently installed calendar-cli and it looks promising! However, display calendar agendas (from Nextcloud Server) shows the wrong event time, e.g. The event is scheduled for 10:00 o'clock in Nextcloud, calendar-cli shows 8:00 o'clock. Setting the timezone in config file to

"timezone": "Europe/Berlin"

does not work. Any suggestions? Thanks, Sven

IndexError: list index out of range in File "./bin/calendar-cli.py", line 66, in find_calendar

I am trying to list calendar entries:

./bin/calendar-cli.py --caldav-url=http://localhost:5232 --caldav-user=d --caldav-pass=d calendar agenda
Traceback (most recent call last):
  File "./bin/calendar-cli.py", line 666, in <module>
    main()
  File "./bin/calendar-cli.py", line 663, in main
    ret = args.func(caldav_conn, args)
  File "./bin/calendar-cli.py", line 328, in calendar_agenda
    events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend)
  File "./bin/calendar-cli.py", line 66, in find_calendar
    return caldav.Principal(caldav_conn).calendars()[0]
IndexError: list index out of range

The server gives this:

PROPFIND request at / received
Request headers:
{'CONTENT_LENGTH': '189',
 'CONTENT_TYPE': 'text/xml',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/xml',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_DEPTH': '0',
 'HTTP_HOST': 'localhost:5232',
 'HTTP_USER_AGENT': 'Mozilla/5.0',
 'PATH_INFO': '/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': 'localhost',
 'REQUEST_METHOD': 'PROPFIND',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'chinabox',
 'SERVER_PORT': '5232',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.11',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fbd3d9ec1e0>,
 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7fbd3b55a940>,
 'wsgi.input': <socket._fileobject object at 0x7fbd3b40ec50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
Sanitized path: /
Anonymous has read access to collection /
Anonymous has write access to collection /
Request content:
<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV" xmlns:ns0="DAV:"><ns0:prop><ns0:current-user-principal/></ns0:prop></ns0:propfind>
Response content:
<?xml version="1.0"?>
<multistatus xmlns="DAV:">
  <response>
    <href>/</href>
    <propstat>
      <prop />
      <status>HTTP/1.1 200 OK</status>
    </propstat>
    <propstat>
      <prop>
        <current-user-principal />
      </prop>
      <status>HTTP/1.1 404 Not Found</status>
    </propstat>
  </response>
</multistatus>

Answer status: 207 Unknown
PROPFIND request at / received
Request headers:
{'CONTENT_LENGTH': '182',
 'CONTENT_TYPE': 'text/xml',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/xml',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_DEPTH': '0',
 'HTTP_HOST': 'localhost:5232',
 'HTTP_USER_AGENT': 'Mozilla/5.0',
 'PATH_INFO': '/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': 'localhost',
 'REQUEST_METHOD': 'PROPFIND',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'chinabox',
 'SERVER_PORT': '5232',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.11',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fbd3d9ec1e0>,
 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7fbd3b55a940>,
 'wsgi.input': <socket._fileobject object at 0x7fbd3b40ec50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
Sanitized path: /
Anonymous has read access to collection /
Anonymous has write access to collection /
Request content:
<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV" xmlns:ns0="DAV:"><ns0:prop><C:calendar-home-set/></ns0:prop></ns0:propfind>
Response content:
<?xml version="1.0"?>
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
  <response>
    <href>/</href>
    <propstat>
      <prop>
        <C:calendar-home-set>
          <href>/</href>
        </C:calendar-home-set>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
</multistatus>

Answer status: 207 Unknown
PROPFIND request at / received
Request headers:
{'CONTENT_LENGTH': '179',
 'CONTENT_TYPE': 'text/xml',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/xml',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_DEPTH': '1',
 'HTTP_HOST': 'localhost:5232',
 'HTTP_USER_AGENT': 'Mozilla/5.0',
 'PATH_INFO': '/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_HOST': 'localhost',
 'REQUEST_METHOD': 'PROPFIND',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'chinabox',
 'SERVER_PORT': '5232',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.11',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fbd3d9ec1e0>,
 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7fbd3b55a940>,
 'wsgi.input': <socket._fileobject object at 0x7fbd3b40ec50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}
Sanitized path: /
Anonymous has read access to collection /
Anonymous has write access to collection /
Anonymous has read access to item a479f75f-ce91-41f6-9052-446c74be367d
Anonymous has write access to item a479f75f-ce91-41f6-9052-446c74be367d
Request content:
<?xml version='1.0' encoding='utf-8'?>
<ns0:propfind xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV" xmlns:ns0="DAV:"><ns0:prop><ns0:resourcetype/></ns0:prop></ns0:propfind>
Response content:
<?xml version="1.0"?>
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
  <response>
    <href>/a479f75f-ce91-41f6-9052-446c74be367d</href>
    <propstat>
      <prop>
        <resourcetype />
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
  <response>
    <href>/</href>
    <propstat>
      <prop>
        <resourcetype>
          <principal />
          <C:calendar />
          <collection />
        </resourcetype>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
</multistatus>

Answer status: 207 Unknown

It's a simple radicale server.

Feature: allow "displaced" options

With subcommands and subsubcommands all taking slightly different options, there is bound to be confusion on where the options should go. There must be some way to parse displaced options.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.