示例#1
0
def callPeopleMatch(accessToken):
    r'This example does match on People document class using input of name and address.'
    endpoint = "/people/match"

    nameAddress = callDSAPI.getSampleRecordWithNameAddress()
    options = callDSAPI.getPeopleMatchOptions()
    payload = dict(
        list(json.loads(nameAddress).items()) +
        list(json.loads(options).items()))

    response = callDSAPI.get(endpoint, accessToken, payload)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
        responseBody = json.loads(response.text)
        person = responseBody['person']
        if 'abilitec' in person:
            print('consumer link=' + person['abilitec']['consumerLink'])
        if 'basicDemographics' in person:
            age = person['basicDemographics']['age'] if 'age' in person[
                'basicDemographics'] else ''
            occupation = person['basicDemographics'][
                'occupation'] if 'occupation' in person[
                    'basicDemographics'] else ''
            print('age=' + str(age))
            print('occupation=' + occupation)
    else:
        print('People match call returned ' + str(statusCode))
示例#2
0
def callEntitiesMatch(accessToken):
    endpoint = "/entities/match"

    nameAddress = callDSAPI.getSampleRecordWithNameAddress()
    payload = json.loads(nameAddress)

    response = callDSAPI.get(endpoint, accessToken, payload)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
    else:
        print('Entities match call returned ' + str(statusCode))
示例#3
0
def callHouseholdsMatch(accessToken):
    endpoint = "/households/match"

    nameAddress = callDSAPI.getSampleRecordWithNameAddress()
    payload = json.loads(nameAddress)

    response = callDSAPI.get(endpoint, accessToken, payload)
    statusCode = response.status_code
    if (statusCode == 200):
        print response.text
    else:
        print 'Households match call returned ' + str(statusCode)
示例#4
0
def callSHA1Lookup(accessToken):
    r'This example does ERL lookup on Households document class using input of SHA1-hashed email address.'
    endpoint = "/households/sha1/"

    lookupValue = callDSAPI.getERLWithEmail()
    uri = endpoint + lookupValue

    response = callDSAPI.get(uri, accessToken)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
    else:
        print('ERL(SHA1) lookup call returned ' + str(statusCode))
示例#5
0
def callAbilitecLookup(accessToken):
    r'This example does Abilitec lookup on People document class using input of Consumer Link.'
    endpoint = "/people/abilitec/"

    lookupValue = callDSAPI.getERWithAbilitecLink()
    uri = endpoint + lookupValue

    response = callDSAPI.get(uri, accessToken)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
    else:
        print('Abilitec lookup call returned ' + str(statusCode))
示例#6
0
def callPlacesMatch(accessToken):
    endpoint = "/places/match"

    address = callDSAPI.getSampleRecordWithAddress()
    payload = json.loads(address)

    response = callDSAPI.get(endpoint, accessToken, payload)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
        responseBody = json.loads(response.text)
        place = responseBody['place']
        if 'id' in place:
            print('id=' + place['id'])
    else:
        print('Places match call returned ' + str(statusCode))
示例#7
0
def callERLookup(accessToken):
    r'This example does Entity Representation lookup on People document class using input of name and address.'
    endpoint = "/people/er/"

    lookupValue = callDSAPI.getERWithNameAddress()
    data = urllib.parse.quote(lookupValue)
    uri = endpoint + data

    options = callDSAPI.getERLookupOptions()
    params = urllib.parse.urlencode(json.loads(options))

    response = callDSAPI.get(uri, accessToken, params)
    statusCode = response.status_code
    if (statusCode == 200):
        print(response.text)
    else:
        print('ER lookup call returned ' + str(statusCode))