# Python Datetime Module to set custom tags

**URL:** <https://community.dynatrace.com/t/python-datetime-module-to-set-custom-tags/38329>\
**Category:** Extensions\
**Tags:** python, extensions\
**Created:** [February 8, 2023, 1:01pm UTC](https://community.dynatrace.com/t/python-datetime-module-to-set-custom-tags/38329 "2023-02-08T13:01:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jstrick](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jstrick](https://community.dynatrace.com/u/jstrick)\
**Post date:** [February 8, 2023, 1:01pm UTC](https://community.dynatrace.com/t/python-datetime-module-to-set-custom-tags/38329/1 "2023-02-08T13:01:20Z")

</div>

I’m trying to use the Python dt module to set custom tags but I keep running into an error saying some problem with the tags parameter like “AttributeError: ‘dict’ object has no attribute ‘to\_json’”.&nbsp; The custom\_tags.post function contains the following value for the parameter:&nbsp;(parameter) tags: List[AddEntityTags]. I’m probably missing something simple but what is the List type that’s expected? I can do this with no problem using curl but I can’t seem to use the dt module.

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [March 1, 2023, 11:20am UTC](https://community.dynatrace.com/t/python-datetime-module-to-set-custom-tags/38329/2 "2023-03-01T11:20:38Z")

</div>

Hi&nbsp;[@jstrick](https://community.dynatrace.com/user/51588)&nbsp;,

try passing the tags as follows:

```markup
tag_list = [AddEntityTags("tag-key", "tag-value")]
dt.custom_tags.post("type(custom_device),entityName(TEST)", tag_list)

```
