<commit_before>import sys, requests, json


tokenFile = 'token.txt'
hpsaServer = 'mslon001pngx.saas.hp.com'
tenantId = 725867830
entityType = 'Person'

"""
Get all records
"""
def getRecord(server, token, tenantId, entityType):
    rest = 'rest/{0}/ems/{1}'.format(tenantId, entityType)
    url = 'https://{0}/{1}'.format(server, rest)
    params = {'layout': 'Name'}
    cookies = {'LWSSO_COOKIE_KEY': token, 'TENANTID': str(tenantId)}
    r = requests.get(url, params=params, cookies=cookies)
    if r.status_code == requests.codes.ok:
        return json.loads(r.text)
    return None

"""
MAIN
"""
if len(sys.argv) == 2:
    entityType = sys.argv[1]

with open(tokenFile) as f:
    token = f.read()
    records = getRecord(hpsaServer, token, tenantId, entityType) 
    print(json.dumps(records, indent=4, sort_keys=True))
    print('Found {0} records'.format(len(records['entities'])))<commit_msg>check records before conting<commit_after>import sys, requests, json


tokenFile = 'token.txt'
hpsaServer = 'mslon001pngx.saas.hp.com'
tenantId = 725867830
entityType = 'Person'

"""
Get all records
"""
def getRecord(server, token, tenantId, entityType):
    rest = 'rest/{0}/ems/{1}'.format(tenantId, entityType)
    url = 'https://{0}/{1}'.format(server, rest)
    params = {'layout': 'Name'}
    cookies = {'LWSSO_COOKIE_KEY': token, 'TENANTID': str(tenantId)}
    r = requests.get(url, params=params, cookies=cookies)
    if r.status_code == requests.codes.ok:
        return json.loads(r.text)
    return None

"""
MAIN
"""
if len(sys.argv) == 2:
    entityType = sys.argv[1]

with open(tokenFile) as f:
    token = f.read()
    records = getRecord(hpsaServer, token, tenantId, entityType) 
    print(json.dumps(records, indent=4, sort_keys=True))
    if records:
        print('Found {0} records'.format(len(records['entities'])))
{'fraction_non_alphanumeric': 0.16494284158954817, 'fraction_numerical': 0.021774632553075667, 'mean_word_length': 4.192090395480226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6661456', 'n_tokens_mistral': 673, 'n_tokens_neox': 660, 'n_words': 140}