diff --git a/docs/conf.py b/docs/conf.py index 0bcaa5efd..e25ae8a9c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -16,7 +16,7 @@ project = 'Python SDK reference' copyright = '2024, Labelbox' author = 'Labelbox' -release = '3.77.0' +release = '3.77.1' # -- General configuration --------------------------------------------------- diff --git a/libs/labelbox/CHANGELOG.md b/libs/labelbox/CHANGELOG.md index 31c378d64..ef7568f64 100644 --- a/libs/labelbox/CHANGELOG.md +++ b/libs/labelbox/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +# Version 3.77.1 (2024-08-28) +## Fixed +* Restore client.headers([#1781](https://github.com/Labelbox/labelbox-python/pull/1781)) + # Version 3.77.0 (2024-08-09) ## Added * LabelingService request()([#1761](https://github.com/Labelbox/labelbox-python/pull/1761)) diff --git a/libs/labelbox/pyproject.toml b/libs/labelbox/pyproject.toml index 8df639932..35865e6f5 100644 --- a/libs/labelbox/pyproject.toml +++ b/libs/labelbox/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "labelbox" -version = "3.77.0" +version = "3.77.1" description = "Labelbox Python API" authors = [{ name = "Labelbox", email = "engineering@labelbox.com" }] dependencies = [ diff --git a/libs/labelbox/src/labelbox/__init__.py b/libs/labelbox/src/labelbox/__init__.py index 889e40158..f55ef6ef4 100644 --- a/libs/labelbox/src/labelbox/__init__.py +++ b/libs/labelbox/src/labelbox/__init__.py @@ -1,6 +1,6 @@ name = "labelbox" -__version__ = "3.77.0" +__version__ = "3.77.1" from labelbox.client import Client from labelbox.schema.project import Project diff --git a/libs/labelbox/src/labelbox/client.py b/libs/labelbox/src/labelbox/client.py index 86c2f86e2..126d07428 100644 --- a/libs/labelbox/src/labelbox/client.py +++ b/libs/labelbox/src/labelbox/client.py @@ -9,7 +9,8 @@ import urllib.parse from collections import defaultdict from datetime import datetime, timezone -from typing import Any, List, Dict, Union, Optional, overload +from typing import Any, List, Dict, Union, Optional, overload, Callable +from types import MappingProxyType import requests import requests.exceptions @@ -126,6 +127,10 @@ def _init_connection(self) -> requests.Session: return connection + @property + def headers(self) -> MappingProxyType: + return self._connection.headers + def _default_headers(self): return { 'Authorization': 'Bearer %s' % self.api_key, diff --git a/libs/labelbox/tests/unit/test_client.py b/libs/labelbox/tests/unit/test_client.py new file mode 100644 index 000000000..9a97591f3 --- /dev/null +++ b/libs/labelbox/tests/unit/test_client.py @@ -0,0 +1,15 @@ +import os + +from unittest.mock import patch + +from labelbox.client import Client + + +# @patch.dict(os.environ, {'LABELBOX_API_KEY': 'bar'}) +def test_headers(): + client = Client(api_key="api_key", endpoint="http://localhost:8080/_gql") + assert client.headers + assert client.headers["Authorization"] == "Bearer api_key" + assert client.headers["Content-Type"] == "application/json" + assert client.headers["User-Agent"] + assert client.headers["X-Python-Version"]