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

Commit 74f1999

Browse files
committed
remove --api option and leave --openapi in place
1 parent 6d6dd33 commit 74f1999

5 files changed

Lines changed: 5 additions & 37 deletions

File tree

CloudFlare/cloudflare.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,6 @@ def _call_unwrapped(self, method, headers, parts, identifiers, params, data, fil
539539
result = response_data
540540
return result
541541

542-
def api_from_web(self):
543-
""" Cloudflare v4 API"""
544-
545-
# base url isn't enough; we need less
546-
url = '/'.join(self.base_url.split('/')[0:3])
547-
return self._read_from_web(url)
548-
549542
def api_from_openapi(self, url):
550543
""" Cloudflare v4 API"""
551544

Makefile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,6 @@ sign:
9292
lint:
9393
$(PYLINT) CloudFlare cli4
9494

95-
api:
96-
@tmp=/tmp/_$$$$_ ; \
97-
$(PYTHON) -m cli4 --dump | sort > $$tmp.1 ; \
98-
$(PYTHON) -m cli4 --api | sed -e 's/^[A-Z][A-Z]* *//' -e 's/?.*//' -e 's/\/:[a-z][A-Za-z_]*/\/:id/g' -e 's/\/:[a-z][A-Za-z_]*}/\/:id/g' -e 's/:id\/:id/:id/' -e 's/\/:id$$//' -e 's/\/:id$$//' -e 's/\/:id ;/ ;/' -e 's/\/$$//' | sort -u > $$tmp.2 ; \
99-
egrep -v '; deprecated' < $$tmp.2 | diff $$tmp.1 - > $$tmp.3 ; \
100-
echo "In code:" ; \
101-
egrep '< ' < $$tmp.3 | sed -e 's/< / /' | sort | tee $$tmp.4 ; \
102-
echo "In docs:" ; \
103-
egrep '> ' < $$tmp.3 | sed -e 's/> / /' | sort | sed -e "s/\//self.add('AUTH', '/" -e "s/$$/'\)/" -e "s/\/:id\//', '/g" ; \
104-
echo "Deprecated:" ; \
105-
egrep '; deprecated' < $$tmp.2 | while read cmd x deprecated deprecated_date ; do egrep "$$cmd" $$tmp.4 | sed -e "s/$$/ ; deprecated $$deprecated_date/" ; done | sort | uniq ; \
106-
rm $$tmp.?
107-
10895
openapi:
10996
@tmp=/tmp/_$$$$_ ; \
11097
$(PYTHON) -m cli4 --dump | sort > $$tmp.1 ; \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ All API calls can be called from the command line.
561561
The command will convert domain names prefixed with a colon (`:`) into zone_identifiers: e.g. to view `example.com` you must use `cli4 /zones/:example.com` (the zone ID cannot be used).
562562

563563
```bash
564-
$ cli4 [-V|--version] [-h|--help] [-v|--verbose] [-q|--quiet] [-j|--json] [-y|--yaml] [-r|--raw] [-d|--dump] [--get|--patch|--post|--put|--delete] [item=value ...] /command...
564+
$ cli4 [-V|--version] [-h|--help] [-v|--verbose] [-q|--quiet] [-j|--json] [-y|--yaml] [-n|ndjson] [-r|--raw] [-d|--dump] [-A|--openapi url] [-b|--binary] [-p|--profile profile-name] [--get|--patch|--post|--put|--delete] [item=value|item=@filename|@filename ...] /command ...
565565

566566
```
567567

cli4/cli4.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ def do_it(args):
367367
output = 'json'
368368
raw = False
369369
dump = False
370-
dump_from_web = False
371370
openapi_url = None
372371
binary_file = False
373372
profile = None
@@ -378,7 +377,6 @@ def do_it(args):
378377
+ '[-j|--json] [-y|--yaml] [-n|ndjson] '
379378
+ '[-r|--raw] '
380379
+ '[-d|--dump] '
381-
+ '[-a|--api] '
382380
+ '[-A|--openapi url] '
383381
+ '[-b|--binary] '
384382
+ '[-p|--profile profile-name] '
@@ -388,12 +386,12 @@ def do_it(args):
388386

389387
try:
390388
opts, args = getopt.getopt(args,
391-
'VhvqjyrdaA:bp:GPOUD',
389+
'VhvqjyrdA:bp:GPOUD',
392390
[
393391
'version',
394392
'help', 'verbose', 'quiet', 'json', 'yaml', 'ndjson',
395393
'raw',
396-
'dump', 'api', 'openapi=',
394+
'dump', 'openapi=',
397395
'binary',
398396
'profile=',
399397
'get', 'patch', 'post', 'put', 'delete'
@@ -427,8 +425,6 @@ def do_it(args):
427425
profile = arg
428426
elif opt in ('-d', '--dump'):
429427
dump = True
430-
elif opt in ('-a', '--api'):
431-
dump_from_web = True
432428
elif opt in ('-A', '--openapi'):
433429
openapi_url = arg
434430
elif opt in ('-b', '--binary'):
@@ -454,11 +450,6 @@ def do_it(args):
454450
sys.stdout.write(a)
455451
sys.exit(0)
456452

457-
if dump_from_web:
458-
a = dump_commands_from_web(cf)
459-
sys.stdout.write(a)
460-
sys.exit(0)
461-
462453
if openapi_url:
463454
a = dump_commands_from_web(cf, openapi_url)
464455
sys.stdout.write(a)

cli4/dump.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ def dump_commands(cf):
55
w = cf.api_list()
66
return '\n'.join(w) + '\n'
77

8-
def dump_commands_from_web(cf, url=None):
8+
def dump_commands_from_web(cf, url):
99
"""dump a tree of all the known API commands - from web"""
10-
if url:
11-
w = cf.api_from_openapi(url)
12-
else:
13-
w = cf.api_from_web()
10+
w = cf.api_from_openapi(url)
1411

1512
a = []
1613
for r in w:

0 commit comments

Comments
 (0)