Skip to content

Commit da1ddea

Browse files
committed
chore: update package manager to yarn@4.9.4 and enhance user agent format to include Python version
1 parent 2a33e98 commit da1ddea

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

Monei/monei_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import hmac
33
import hashlib
4+
import sys
45

56
# Import specific modules instead of importing from Monei
67
import Monei
@@ -16,7 +17,7 @@
1617
from Monei.exceptions import ApiException
1718

1819

19-
DEFAULT_USER_AGENT = f"MONEI/Python/{Monei.__version__}"
20+
DEFAULT_USER_AGENT = f"MONEI/Python/{Monei.__version__} (Python v{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro})"
2021

2122

2223
class MoneiClient(object):

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
"lint-staged": "^15.4.3",
3131
"release-it": "^18.1.2"
3232
},
33-
"packageManager": "yarn@4.7.0"
33+
"packageManager": "yarn@4.9.4"
3434
}

test/test_monei_client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,23 @@ def test_default_user_agent_always_set(self):
267267
# Check that the user agent is set in the API client
268268
self.assertEqual(client._api_client.user_agent, DEFAULT_USER_AGENT)
269269

270+
def test_default_user_agent_format_includes_python_version(self):
271+
"""Test that DEFAULT_USER_AGENT includes Python version in the correct format."""
272+
import sys
273+
import Monei
274+
275+
# Check that the user agent follows the expected format: MONEI/Python/2.0.2 (Python v3.12.9)
276+
expected_format = f"MONEI/Python/{Monei.__version__} (Python v{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro})"
277+
self.assertEqual(DEFAULT_USER_AGENT, expected_format)
278+
279+
# Verify the format components
280+
self.assertTrue(DEFAULT_USER_AGENT.startswith("MONEI/Python/"))
281+
self.assertIn(
282+
f"(Python v{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro})",
283+
DEFAULT_USER_AGENT,
284+
)
285+
self.assertIn(Monei.__version__, DEFAULT_USER_AGENT)
286+
270287

271288
if __name__ == "__main__":
272289
unittest.main()

0 commit comments

Comments
 (0)