Skip to content

Commit b5717be

Browse files
sladkaniinfothrill
authored andcommitted
update_check: Remove 'verify_certificate' of non-http check params (#67)
The following sequence, for an existing *non* http check, fails: chk = client.get_check(name='testcheck') client.update_check(chk, some_update_params) With the error 400 'Invalid parameter: verify_certificate'. This is since 'verify_certificate' field is always present when issuing GET /checks. Sanitize the data passed to PUT /checks/{check_id} by stripping the 'verify_certificate' parameter for non-http checks.
1 parent 31f6392 commit b5717be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pypingdom/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def update_check(self, check, changes):
7171
data = check.to_json()
7272
if data == cached_definition:
7373
return False
74+
if check.type != 'http':
75+
# GET /checks (get_checks) returns 'verify_certificate' regardless
76+
# check type. Remove from PUT data for non http checks
77+
del data['verify_certificate']
7478
del data["type"] # type can't be changed
7579
self.api.send(method='put', resource='checks', resource_id=check._id, data=data)
7680
check.from_json(self.api.send('get', "checks", check._id)['check'])

0 commit comments

Comments
 (0)