@@ -396,6 +396,7 @@ def do_it(args):
396396 openapi_url = None
397397 binary_file = False
398398 profile = None
399+ http_headers = None
399400 method = 'GET'
400401
401402 usage = ('usage: cli4 '
@@ -408,13 +409,14 @@ def do_it(args):
408409 + '[-A|--openapi url] '
409410 + '[-b|--binary] '
410411 + '[-p|--profile profile-name] '
412+ + '[-h|--header additional-header] '
411413 + '[--get|--patch|--post|--put|--delete] '
412414 + '[item=value|item=@filename|@filename ...] '
413415 + '/command ...' )
414416
415417 try :
416418 opts , args = getopt .getopt (args ,
417- 'VhveqjynirdA:bp:GPOUD' ,
419+ 'VhveqjynirdA:bp:h: GPOUD' ,
418420 [
419421 'version' , 'help' , 'verbose' ,
420422 'examples' ,
@@ -425,6 +427,7 @@ def do_it(args):
425427 'openapi=' ,
426428 'binary' ,
427429 'profile=' ,
430+ 'header=' ,
428431 'get' , 'patch' , 'post' , 'put' , 'delete'
429432 ])
430433 except getopt .GetoptError :
@@ -454,6 +457,10 @@ def do_it(args):
454457 raw = True
455458 elif opt in ('-p' , '--profile' ):
456459 profile = arg
460+ elif opt in ('-h' , '--header' ):
461+ if http_headers is None :
462+ http_headers = []
463+ http_headers .append (arg )
457464 elif opt in ('-d' , '--dump' ):
458465 do_dump = True
459466 elif opt in ('-A' , '--openapi' ):
@@ -480,7 +487,7 @@ def do_it(args):
480487 sys .exit (0 )
481488
482489 try :
483- cf = CloudFlare .CloudFlare (debug = verbose , raw = raw , profile = profile )
490+ cf = CloudFlare .CloudFlare (debug = verbose , raw = raw , profile = profile , http_headers = http_headers )
484491 except Exception as e :
485492 sys .exit (e )
486493
0 commit comments