# Getting Specific Contact Property

**URL:** <https://community.hubspot.com/t/getting-specific-contact-property/42471>\
**Category:** APIs & Integrations\
**Tags:** python, contacts, starter\
**Created:** [August 18, 2021, 12:03am UTC](https://community.hubspot.com/t/getting-specific-contact-property/42471 "2021-08-18T00:03:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsignori](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lsignori/32/99949_2.png) [@lsignori](https://community.hubspot.com/u/lsignori)\
**Post date:** [August 18, 2021, 12:03am UTC](https://community.hubspot.com/t/getting-specific-contact-property/42471/1 "2021-08-18T00:03:35Z")

</div>

I am trying to get the “city” property for all emails, but it never shows up in my result dictionary. Any idea for what needs to be added or modified?

```lia-code-sample
import requests
import json
import urllib

max_results = 50 
hapikey = 'XXX' 
count = 5 
contact_list = []
property_list = ["city"]
get_all_contacts_url = "http://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=XXX&property=city"
headers = {}

# Paginate your request using offset
has_more = True
while has_more:
	parameters = urllib.parse.urlencode(parameter_dict)
	get_url = get_all_contacts_url + parameters
	r = requests.get(url= get_url, headers = headers)
	response_dict = json.loads(r.text)
	has_more = response_dict['has-more']
	contact_list.extend(response_dict['contacts'])
	parameter_dict['vidOffset']= response_dict['vid-offset']
	if len(contact_list) >= max_results: # Exit pagination, based on whatever value you've set your max results variable to. 
		print('maximum number of results exceeded')
		break
print('loop finished')

list_length = len(contact_list) 

print("You've succesfully parsed through {} contact records and added them to a list".format(list_length))

```

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 18, 2021, 7:57pm UTC](https://community.hubspot.com/t/getting-specific-contact-property/42471/2 "2021-08-18T19:57:35Z")

</div>

@lsignori ,

The URL is structured properly other than you are using http instead of https.

I am not a python person. @taran42 , do you see anything out of place?

@lsignori , is there a reason you are using the v1 endpoint rather than the [newer v3](https://developers.hubspot.com/docs/api/crm/contacts)?

---

<div class="post-metadata">

**Author:** ![lsignori](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/lsignori/32/99949_2.png) [@lsignori](https://community.hubspot.com/u/lsignori)\
**Post date:** [August 18, 2021, 8:41pm UTC](https://community.hubspot.com/t/getting-specific-contact-property/42471/3 "2021-08-18T20:41:13Z")

</div>

@dennisedsonthank you! I used version 3 and it worked:

```lia-code-sample
pip install --upgrade hubspot-api-client

import hubspot
from pprint import pprint
from hubspot.crm.contacts import ApiException

client = hubspot.Client.create(api_key="xxx")

try:
 api_response = client.crm.contacts.basic_api.get_page(limit=10, properties=["city"], archived=False)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling basic_api->get_page: %s\n" % e)

```
