Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 7c0fc05

Browse files
author
Tobias Martin
committed
add missing HTTP method put, fix unknown exception class
1 parent 6fff910 commit 7c0fc05

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cloudflare_v4/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def call(self, method, main_endpoint, endpoint=None, params=None, data=None):
4747
params=params_to_send)
4848
elif method == 'POST':
4949
response = requests.post(url, headers=headers, json=data)
50+
elif method == 'PUT':
51+
response = requests.put(url, headers=headers, json=data)
5052
elif method == 'DELETE':
5153
if data:
5254
response = requests.delete(url, headers=headers, json=data)
@@ -55,7 +57,7 @@ def call(self, method, main_endpoint, endpoint=None, params=None, data=None):
5557
elif method == 'PATCH':
5658
pass
5759
else:
58-
raise CloudFlareAPIInternalError('method not supported') # should never happen
60+
raise CloudFlareAPIError('method not supported') # should never happen
5961
data = response.text
6062
self.logger.debug("data received: %s" % data)
6163
try:
@@ -84,10 +86,15 @@ def post(self, params=None, data=None):
8486
return self.base_client.call('POST', self.main_endpoint,
8587
self.endpoint, params, data)
8688

89+
def put(self, params=None, data=None):
90+
return self.base_client.call('PUT', self.main_endpoint,
91+
self.endpoint, params, data)
92+
8793
def delete(self, params=None, data=None):
8894
return self.base_client.call('DELETE', self.main_endpoint,
8995
self.endpoint, params, data)
9096

97+
9198
def __init__(self, email, token, debug):
9299
self.base_client = self.BaseClient(email, token, debug)
93100
setattr(self, "zones", self.DynamicClient(self.base_client, "zones"))

0 commit comments

Comments
 (0)