diff --git a/.gitignore b/.gitignore index f0eda65..a4c0229 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ build/ .pytest_cache/ .env venv/ -.vscode \ No newline at end of file +.vscode +.DS_Store \ No newline at end of file diff --git a/linkedin_api/__init__.py b/linkedin_api/__init__.py index e69de29..a68927d 100644 --- a/linkedin_api/__init__.py +++ b/linkedin_api/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" \ No newline at end of file diff --git a/linkedin_api/clients/restli/utils/api.py b/linkedin_api/clients/restli/utils/api.py index fe2111b..94837ad 100644 --- a/linkedin_api/clients/restli/utils/api.py +++ b/linkedin_api/clients/restli/utils/api.py @@ -1,4 +1,5 @@ import linkedin_api.common.constants as constants +from linkedin_api import __version__ from linkedin_api.clients.restli.utils.encoder import encode from typing import Dict, Any, Optional from linkedin_api.common.errors import InvalidArgumentError @@ -16,7 +17,8 @@ def get_restli_request_headers(*, restli_method: constants.RESTLI_METHODS, acces "X-RestLi-Protocol-Version": "2.0.0", "X-RestLi-Method": restli_method.value, "Authorization": "Bearer " + access_token, - "Content-Type": content_type + "Content-Type": content_type, + "User-Agent": f"linkedin-api-python-client/{__version__}" } if (version_string is not None): headers.update({ "LinkedIn-Version": version_string }) diff --git a/tests/clients/restli/client_test.py b/tests/clients/restli/client_test.py index 8e677b2..70ad12d 100644 --- a/tests/clients/restli/client_test.py +++ b/tests/clients/restli/client_test.py @@ -1,5 +1,6 @@ import json from linkedin_api.clients.restli.client import RestliClient +from linkedin_api import __version__ import pytest import responses from responses import matchers @@ -43,7 +44,8 @@ "Authorization": "Bearer ABC123", "X-RestLi-Protocol-Version": "2.0.0", "Content-Type": "application/json", - "X-RestLi-Method": RESTLI_METHODS.GET.value + "X-RestLi-Method": RESTLI_METHODS.GET.value, + "User-Agent": f"linkedin-api-python-client/{__version__}" }, "response_properties": { "entity": {"name": "TestAdAccount"}