From 1883267871bd6b3e5ef41c363acd80abf9ccbdad Mon Sep 17 00:00:00 2001 From: "andrii.porokhnavets" Date: Fri, 7 Apr 2023 17:41:42 +0300 Subject: [PATCH] Add User-Agent header --- mailtrap/client.py | 3 +++ tests/unit/test_client.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mailtrap/client.py b/mailtrap/client.py index 21675bf..342fc2a 100644 --- a/mailtrap/client.py +++ b/mailtrap/client.py @@ -43,6 +43,9 @@ def headers(self) -> Dict[str, str]: return { "Authorization": f"Bearer {self.token}", "Content-Type": "application/json", + "User-Agent": ( + "mailtrap-python (https://github.com/railsware/mailtrap-python)" + ), } @staticmethod diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 3fa73e8..b34ea2c 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -41,6 +41,9 @@ def test_headers_should_return_appropriate_dict(self) -> None: assert client.headers == { "Authorization": "Bearer fake_token", "Content-Type": "application/json", + "User-Agent": ( + "mailtrap-python (https://github.com/railsware/mailtrap-python)" + ), } @responses.activate