From 00d1160b56097508022bbea1261bedb0a1d17691 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 17 Feb 2023 08:08:35 +0100 Subject: [PATCH] [PR #5927/33df7b61 backport][stable-6] Set User-Agent for API requests to DNSimple (#6005) Set User-Agent for API requests to DNSimple (#5927) * Set the user-agent for API requests to DNSimple * Update user agent format * Add changelog fragment * Update changelogs/fragments/5927-set-user-agent-dnsimple.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit 33df7b61c008ee3331b27af2b43d8c90e04f0c9c) Co-authored-by: Ivan Bakalov --- changelogs/fragments/5927-set-user-agent-dnsimple.yml | 2 ++ plugins/modules/dnsimple.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/5927-set-user-agent-dnsimple.yml diff --git a/changelogs/fragments/5927-set-user-agent-dnsimple.yml b/changelogs/fragments/5927-set-user-agent-dnsimple.yml new file mode 100644 index 0000000000..1082b41481 --- /dev/null +++ b/changelogs/fragments/5927-set-user-agent-dnsimple.yml @@ -0,0 +1,2 @@ +minor_changes: + - "dnsimple - set custom User-Agent for API requests to DNSimple (https://github.com/ansible-collections/community.general/pull/5927)." diff --git a/plugins/modules/dnsimple.py b/plugins/modules/dnsimple.py index e96c22613f..ddd3ba0bab 100644 --- a/plugins/modules/dnsimple.py +++ b/plugins/modules/dnsimple.py @@ -168,7 +168,7 @@ class DNSimpleV2(): def dnsimple_client(self): """creates a dnsimple client object""" if self.account_email and self.account_api_token: - client = Client(sandbox=self.sandbox, email=self.account_email, access_token=self.account_api_token) + client = Client(sandbox=self.sandbox, email=self.account_email, access_token=self.account_api_token, user_agent="ansible/community.general") else: msg = "Option account_email or account_api_token not provided. " \ "Dnsimple authentiction with a .dnsimple config file is not " \