# Python create Contact with umlauts

**URL:** <https://community.hubspot.com/t/python-create-contact-with-umlauts/14539>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [May 28, 2019, 10:33am UTC](https://community.hubspot.com/t/python-create-contact-with-umlauts/14539 "2019-05-28T10:33:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akaiser](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/akaiser/32/93181_2.png) [@akaiser](https://community.hubspot.com/u/akaiser)\
**Post date:** [May 28, 2019, 10:33am UTC](https://community.hubspot.com/t/python-create-contact-with-umlauts/14539/1 "2019-05-28T10:33:22Z")

</div>

Hey Guys!

i currently create contacts over the API, it also working flawless with normal ones.

But when a customer have umaluts in their name i get problems.

```auto
	def createContact(self,props):
		output = "{\"properties\": ["
		for prop in props:
			output = output + prop.getJSON() + ","
		output = output[:-1] + "]}"
		headers = {"Content-Type":"application/json"}
		r = requests.post(self.AUTH_URL + "/contacts/v1/contact/?hapikey="+API_KEY, data = output, headers = headers )
		return r.json()

```

This code works flawless with normal contacts, but with umlauts i get this error.

 ![Capture.PNG](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/e/4e6a4693b9c8fd0f227970efe958a5a60031c0ae.png)

---

<div class="post-metadata">

**Author:** ![akaiser](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/akaiser/32/93181_2.png) [@akaiser](https://community.hubspot.com/u/akaiser)\
**Post date:** [May 28, 2019, 3:06pm UTC](https://community.hubspot.com/t/python-create-contact-with-umlauts/14539/2 "2019-05-28T15:06:02Z")

</div>

#closed

when i add directly in the request function “.encode” everything works, when i want to encode just the variable then it’s not working…weird

fix:

```auto
	def createContact(self,props):
		output = "{\"properties\": ["
		for prop in props:
			output = output + prop.getJSON() + ","
		output = output[:-1] + "]}"
		headers = {"Content-Type":"application/json"}
		r = requests.post(self.AUTH_URL + "/contacts/v1/contact/?hapikey="+API_KEY, data = output.encode('utf-8'), headers = headers )
		return r.json()

```

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [May 30, 2019, 12:52pm UTC](https://community.hubspot.com/t/python-create-contact-with-umlauts/14539/3 "2019-05-30T12:52:04Z")

</div>

Thanks for sharing your solution, @akaiser!
