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

Commit 28daae8

Browse files
committed
fix delete endpoint
1 parent 985ef56 commit 28daae8

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

cloudflare_v4/__init__.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,33 @@ def call(self, method, main_endpoint, endpoint=None, params=None, data=None):
2222
else:
2323
url = BASE_URL + '/' + main_endpoint
2424
method = method.upper()
25-
self.logger.debug("EMAIL is: " + str(self.EMAIL))
26-
self.logger.debug("TOKEN is: " + str(self.TOKEN))
27-
self.logger.debug("method type is: " + method)
28-
self.logger.debug("url endpoint is: " + url)
29-
self.logger.debug("optional params is: " + str(params))
30-
self.logger.debug("optional data is: " + str(data))
25+
self.logger.debug("EMAIL is: %s" % str(self.EMAIL))
26+
self.logger.debug("TOKEN is: %s" % str(self.TOKEN))
27+
self.logger.debug("method type is: %s" % method)
28+
self.logger.debug("main endpoint is: %s" % main_endpoint)
29+
self.logger.debug("optional endpoint is: %s" % endpoint)
30+
self.logger.debug("url endpoint is: %s" % url)
31+
self.logger.debug("optional params is: %s" % str(params))
32+
self.logger.debug("optional data is: %s" % str(data))
3133
if (method is None) or (main_endpoint is None):
3234
raise CloudFlareError('You must specify a method and endpoint') # should never happen
3335
else:
34-
self.logger.debug("headers being sent: " + str(headers))
36+
self.logger.debug("headers being sent: %s" % str(headers))
3537
if method == 'GET':
3638
if data:
3739
params_to_send = data
3840
else:
3941
params_to_send = params
42+
self.logger.debug("params being sent: %s", params_to_send)
4043
response = requests.get(url, headers=headers,
4144
params=params_to_send)
4245
elif method == 'POST':
4346
headers['Content-Type'] = 'application/json'
4447
response = requests.post(url, headers=headers, json=data)
4548
elif method == 'DELETE':
46-
response = requests.delete(url, headers=headers, json=data)
49+
response = requests.delete("%s/%s" % (url, data), headers=headers)
4750
data = response.text
48-
self.logger.debug("data received: " + data)
51+
self.logger.debug("data received: %s" % data)
4952
try:
5053
data = json.loads(data)
5154
if data['success'] is False:
@@ -57,9 +60,9 @@ def call(self, method, main_endpoint, endpoint=None, params=None, data=None):
5760

5861
class DynamicClient:
5962
def __init__(self, base_client, main_endpoint, endpoint=None):
60-
base_client.logger.debug("base client is: " + str(base_client))
61-
base_client.logger.debug("main endpoint is: " + str(main_endpoint))
62-
base_client.logger.debug("endpoint is: " + str(endpoint))
63+
base_client.logger.debug("base client is: %s" % str(base_client))
64+
base_client.logger.debug("main endpoint is: %s" % str(main_endpoint))
65+
base_client.logger.debug("endpoint is: %s" % str(endpoint))
6366
self.base_client = base_client
6467
self.main_endpoint = main_endpoint
6568
self.endpoint = endpoint

0 commit comments

Comments
 (0)