Skip to content

Commit

Permalink
now builds TABLE-OF-COMMANDS.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Jan 2, 2024
1 parent 0c85423 commit 8a04e95
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/example_list_api_from_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ def main():
# {"action": "GET", "cmd": "/accounts", "deprecated": false, "deprecated_date": "", "deprecated_already": false}
# {"action": "DELETE", "cmd": "/accounts/:id/addressing/prefixes/:id/delegations", "deprecated": false, "deprecated_date": "", "deprecated_already": false, "content_type": "application/json"}

print('# cloudflare-python')
print('')
print('## Table of commands')
print('')
print('|`GET` |`PUT` |`POST` |`PATCH` |`DELETE`|API call|')
print('|--------|--------|--------|--------|--------|:-------|')

cmds = {}
for r in found_comands:
if r['deprecated'] or r['deprecated_already']:
Expand All @@ -36,13 +43,15 @@ def main():
# GET - PUT PATCH DELETE /zones/:zone_identifier/waiting_rooms/:waiting_room_id

for cmd in cmds.keys():
p = ''
p = '|'
for method in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']:
if method in cmds[cmd]:
p += '%-7s' % method
p += '%-8s|' % ('`' + method + '`')
else:
p += '%-7s' % '-'
print("%s %s" % (p, cmd))
p += '%-8s|' % ('-')
print("%s %s |" % (p, cmd))

print('')

if __name__ == '__main__':
main()
Expand Down

0 comments on commit 8a04e95

Please sign in to comment.