You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
1.3 KiB

# -*- coding: utf-8 -*-
"""Extract customer-related api basline from bruno-recon.json for prototype audit."""
import json
r = json.load(open(r'e:\code\crm-backend-matt\.scratch\customer-rework\bruno-recon.json', encoding='utf-8'))
apis = r['apis']
seen = set()
out = []
for a in apis:
if a['file'].startswith('crm-customer') or a['file'].startswith('crm-preference'):
k = (a['http'], a['url'])
if k in seen:
continue
seen.add(k)
out.append('%-6s %-58s %s.%s' % (a['http'], a['url'], a['className'], a['summary'] or ''))
elif a['file'].startswith('crm-rule') and ('Customer' in a['className']):
k = (a['http'], a['url'])
if k in seen:
continue
seen.add(k)
out.append('%-6s %-58s %s.%s' % (a['http'], a['url'], a['className'], a['summary'] or ''))
elif a['file'].startswith('crm-opportunity') and ('Contact' in a['summary'] or '联系人' in (a['summary'] or '')):
k = (a['http'], a['url'])
if k in seen:
continue
seen.add(k)
out.append('%-6s %-58s %s.%s' % (a['http'], a['url'], a['className'], a['summary'] or ''))
open(r'e:\code\crm-backend-matt\.scratch\customer-rework\audit-api-baseline.txt', 'w', encoding='utf-8').write(
'\n'.join(out))
print('baseline apis:', len(out))