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

Commit 241af4d

Browse files
committed
cleanup of params vs content
1 parent 57e9c0f commit 241af4d

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

cli4/cli4.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def process_params_content_files(method, binary_file, args):
4141
while len(args) > 0 and ('=' in args[0] or args[0][0] == '@'):
4242
arg = args.pop(0)
4343
if arg[0] == '@':
44-
# a file to be uploaded - used in workers/script - only via PUT
44+
# a file to be uploaded - used in workers/script etc - only via PUT or POST
4545
filename = arg[1:]
4646
if method not in ['PUT','POST']:
4747
sys.exit('cli4: %s - raw file upload only with PUT or POST' % (filename))
@@ -259,15 +259,14 @@ def run_command(cf, method, command, params=None, content=None, files=None):
259259
if content and params:
260260
sys.stderr.write('cli4: /%s - content and params not allowed together\n' % (command))
261261
raise Exception
262-
if content:
263-
params = content
264262

265263
results = []
266264
if identifier2 is None:
267265
identifier2 = [None]
268266
for i2 in identifier2:
269267
try:
270268
if method == 'GET':
269+
# no content with a GET call
271270
r = m.get(identifier1=identifier1,
272271
identifier2=i2,
273272
identifier3=identifier3,
@@ -276,22 +275,22 @@ def run_command(cf, method, command, params=None, content=None, files=None):
276275
r = m.patch(identifier1=identifier1,
277276
identifier2=i2,
278277
identifier3=identifier3,
279-
data=params)
278+
data=content)
280279
elif method == 'POST':
281280
r = m.post(identifier1=identifier1,
282281
identifier2=i2,
283282
identifier3=identifier3,
284-
data=params, files=files)
283+
data=content, files=files)
285284
elif method == 'PUT':
286285
r = m.put(identifier1=identifier1,
287286
identifier2=i2,
288287
identifier3=identifier3,
289-
data=params)
288+
data=content)
290289
elif method == 'DELETE':
291290
r = m.delete(identifier1=identifier1,
292291
identifier2=i2,
293292
identifier3=identifier3,
294-
data=params)
293+
data=content)
295294
else:
296295
pass
297296
except CloudFlare.exceptions.CloudFlareAPIError as e:

0 commit comments

Comments
 (0)