# get\_url support custom headers

**URL:** <https://forum.ansible.com/t/get-url-support-custom-headers/16667>\
**Category:** Ansible Project\
**Created:** [November 3, 2014, 8:37am UTC](https://forum.ansible.com/t/get-url-support-custom-headers/16667 "2014-11-03T08:37:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Craft](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Andrew\_Craft](https://forum.ansible.com/u/Andrew_Craft)\
**Post date:** [November 3, 2014, 8:37am UTC](https://forum.ansible.com/t/get-url-support-custom-headers/16667/1 "2014-11-03T08:37:02Z")

</div>

From what i can see get\_url doesn’t support specifying custom http headers like the uri module.

What i am trying to do is download some files from the object storage in Softlayer (based on SwiftStack)

1. Customised the softlayer inventory file to include username and apikey as group\_vars when generating inventory
2. use uri module to authenticate against object storage and get storage auth token
3. use get\_url to download files but need to specify custom header to include token

Am I am correct in saying can’t specify custom header in get\_url, happy to try and create a patch to support this if this is ok?

thanks  
Andrew

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 3, 2014, 2:39pm UTC](https://forum.ansible.com/t/get-url-support-custom-headers/16667/2 "2014-11-03T14:39:07Z")

</div>

It seems to be me (longer-term) we’d benefit from having some modules explicitly for SoftLayer instead as opposed to going through the uri module.

get\_url is basically there for easy downloads of web resources.

I think we are open to the idea of having it take a new parameter (try to match up with what uri does, I’d think).

---

<div class="post-metadata">

**Author:** ![Andrew\_Craft](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Andrew\_Craft](https://forum.ansible.com/u/Andrew_Craft)\
**Post date:** [November 3, 2014, 3:02pm UTC](https://forum.ansible.com/t/get-url-support-custom-headers/16667/3 "2014-11-03T15:02:09Z")

</div>

Agree would be nice for some kind of softlayer support but requires a bit more thought and structure for username/keys/authentication end points etc so figured this would be simpler in short term for my needs and still potentially useful for others

Will take a look and see i can put a patch together.
