summaryrefslogtreecommitdiff
path: root/lib/ansible/galaxy/api.py
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2019-12-03 10:04:41 +1000
committerGitHub <noreply@github.com>2019-12-03 10:04:41 +1000
commit8648003c1fb01da6e194db8b18dbbd9c52745314 (patch)
tree36aa9e29082a0a2973c1a66d27e0eb28df325242 /lib/ansible/galaxy/api.py
parent60755369078d701569713ba066f289401e1104e2 (diff)
downloadansible-8648003c1fb01da6e194db8b18dbbd9c52745314.tar.gz
ansible-galaxy - Add User-Agent to requests (#65438)
Diffstat (limited to 'lib/ansible/galaxy/api.py')
-rw-r--r--lib/ansible/galaxy/api.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py
index 037e0666d2..73b240339b 100644
--- a/lib/ansible/galaxy/api.py
+++ b/lib/ansible/galaxy/api.py
@@ -13,6 +13,7 @@ import time
from ansible import context
from ansible.errors import AnsibleError
+from ansible.module_utils.ansible_release import __version__ as ansible_version
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves.urllib.error import HTTPError
from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlencode, urlparse
@@ -184,7 +185,7 @@ class GalaxyAPI:
try:
display.vvvv("Calling Galaxy at %s" % url)
resp = open_url(to_native(url), data=args, validate_certs=self.validate_certs, headers=headers,
- method=method, timeout=20)
+ method=method, timeout=20, http_agent='ansible-galaxy/%s' % ansible_version)
except HTTPError as e:
raise GalaxyError(e, error_context_msg)
except Exception as e: