Completed
Push — master ( f7c3f8...59d572 )
by Edward
04:38 queued 02:04
created

AddAnnotation.run()   A

Complexity

Conditions 4

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 4
dl 0
loc 17
rs 9.2
1
from lib import action
2
3
4
class AddAnnotation(action.LibratoBaseAction):
5
    def run(self, stream, title, description=None, start_time=None,
6
            end_time=None):
7
        # TODO: Add support for links
8
        data = {
9
            'title': title
10
        }
11
12
        if description:
13
            data['description'] = description
14
15
        if start_time:
16
            data['start_time'] = start_time
17
18
        if end_time:
19
            data['end_time'] = end_time
20
21
        return self.librato.post_annotation(name=stream, **data)
22