[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kroupware
Subject:    Re: shared calendar as long time reminding system?
From:       Thorsten Schnebeck <thorsten.schnebeck () gmx ! net>
Date:       2009-09-12 1:28:02
Message-ID: 200909120328.02366.thorsten.schnebeck () gmx ! net
[Download RAW message or body]

> For a quick and dirty solution *me* thinks about using python + mechanize
>  to simulate using a browser.

attached script as cron job Works For Me(TM) :-)

Bye

  Thorsten

["reminder.py" (text/x-python)]

#!/usr/bin/python
# -*- coding: utf-8 -*-

url = 'https://kolab.mydomain.de/client/imp/'
user = 'termin@mydomain.de'
password = 'mysecretpassword'
processtime = 30

import sys, os, re
from urllib2 import HTTPError
from time import sleep
import mechanize

mech = mechanize.Browser()
mech.set_handle_robots(False)

try:
    mech.open(url)
except HTTPError, e:
    sys.exit("%d: %s" % (e.code, e.msg))

mech.select_form(nr=0)
mech["imapuser"] = user
mech["pass"] = password

try:
    mech.submit()
except HTTPError, e:
    sys.exit("post failed: %d: %s" % (e.code, e.msg))

sleep(processtime)

urls = [link.absolute_url for link in
        mech.links(url_regex=re.compile(r"logout"))]

try:
    mech.open(urls[0])
except HTTPError, e:
    sys.exit("post failed: %d: %s" % (e.code, e.msg))


_______________________________________________
Kolab-users mailing list
Kolab-users@kolab.org
https://kolab.org/mailman/listinfo/kolab-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic