/ usr / bin / kde-print-queue требует прав sudo - как разрешить нормальное использование принтера приостановить?

Не совсем то, что запрашивал OP, но если сторонняя логика разрешена, то проверьте фантастический exchangengelib (python). Быстрый пример py3 получения событий на следующие 3 месяца (обратите внимание, что повторяющиеся элементы были расширены):

import arrow  # not required, but highly recommended lib for time processing
import base64
from tzlocal import get_localzone
from subprocess import call

from exchangelib import DELEGATE, Account, Credentials, EWSDateTime

CREDENTIALS = Credentials(username='mymail@company.com', password='topsecret')
ACCOUNT = Account(primary_smtp_address='mymail@company.com', credentials=CREDENTIALS,
                autodiscover=True, access_type=DELEGATE)

def sanitize(p):
    '''some .ical files didn't have proper end:vcalendar closure'''
    end = 'END:VCALENDAR\n'
    s = base64.b64decode(p).decode().replace("\r\n", "\n")
    if not s.endswith(end):
        s += end

    return s

tz = get_localzone()
now = arrow.now()
upper_limit = now.replace(months=+3)
items = ACCOUNT.calendar.view(
    start=tz.localize(EWSDateTime(now.year, now.month, now.day)),
    end=tz.localize(EWSDateTime(upper_limit.year, upper_limit.month, upper_limit.day)),
)

cals = []  # list of .ical files' contents
for item in items:
    cals.append(sanitize(item.mime_content))

1
04.03.2016, 23:29
0 ответов

Теги

Похожие вопросы