Completed
Pull Request — master (#543)
by
unknown
02:35
created

EnableHookAction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1
1
import json
2
3
from lib.action import TravisCI
4
5
6
class EnableHookAction(TravisCI):
7
    def run(self, hook_id):
8
        """
9
        Enable a hook to monitor through Travis
10
        """
11
        path = '/hooks/' + str(hook_id)
12
        json_req = {
13
            'hook': {
14
                'active': 'true'
15
            }
16
        }
17
        json_req = json.dumps(json_req)
18
        response = self._perform_request(path, data=json_req, method='PUT')
19
        return response.content
20