Example #1
0
        def reload(self, sender):

            calendar_url = CONFIG.get('feed', 'nag')

            try:
                result = requests.get(calendar_url)
            except IOError:
                self.last_pomodoro_name = 'Error loading calendar'
                self.last_pomodoro_timestamp = self.now().replace(microsecond=0)
                return

            cal = Calendar.from_ical(result.text)
            recent = None

            for entry in cal.subcomponents:
                if recent is None:
                    recent = entry
                    continue
                if 'DTEND' not in entry:
                    continue
                if entry['DTEND'].dt > recent['DTEND'].dt:
                    recent = entry

            self.last_pomodoro_name = recent['SUMMARY']
            self.last_pomodoro_timestamp = recent['DTEND'].dt
Example #2
0
        def reload(self, sender):
            api = CONFIG.get('server', 'api')
            token = CONFIG.get('server', 'token')

            response = requests.get(api, token=token, params={
                'orderby':'created',
                'limit':1,
            })
            response.raise_for_status()
            result = response.json()['results'].pop()
            self.last_pomodoro_name = result['title']
            self.last_pomodoro_timestamp = dateutil.parser.parse(result['end'])
            print result
Example #3
0
File: app.py Project: kfdm/hatarake
        def reload(self, sender):
            api = CONFIG.get('server', 'api')
            token = CONFIG.get('server', 'token')

            response = requests.get(api, token=token, params={
                'orderby': 'created',
                'limit': 1,
            })
            response.raise_for_status()
            result = response.json()['results'].pop()
            self.pomodoro = Pomodoro(
                result['title'],
                dateutil.parser.parse(result['end']).replace(microsecond=0)
            )