diff --git a/CHANGELOG.md b/CHANGELOG.md index 148d2e103..a1350462d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * Comparing a Labelbox object (e.g. Project) to None doesn't raise an exception * Adding `order_by` to `Project.labels` doesn't raise an exception +## Version 2.4.10 (2021-01-05) +### Added +* SDK version added to request headers + ## Version 2.4.9 (2020-11-09) ### Fix * 2.4.8 was broken for > Python 3.6 diff --git a/labelbox/__init__.py b/labelbox/__init__.py index 680e44068..0b876d51c 100644 --- a/labelbox/__init__.py +++ b/labelbox/__init__.py @@ -1,4 +1,5 @@ name = "labelbox" +__version__ = "2.4.10" from labelbox.client import Client from labelbox.schema.bulk_import_request import BulkImportRequest @@ -14,4 +15,4 @@ from labelbox.schema.asset_metadata import AssetMetadata from labelbox.schema.webhook import Webhook from labelbox.schema.prediction import Prediction, PredictionModel -from labelbox.schema.ontology import Ontology +from labelbox.schema.ontology import Ontology \ No newline at end of file diff --git a/labelbox/client.py b/labelbox/client.py index 14384da84..cd4bc97a2 100644 --- a/labelbox/client.py +++ b/labelbox/client.py @@ -19,6 +19,7 @@ from labelbox.schema.user import User from labelbox.schema.organization import Organization from labelbox.schema.labeling_frontend import LabelingFrontend +from labelbox import __version__ as SDK_VERSION logger = logging.getLogger(__name__) @@ -66,7 +67,8 @@ def __init__(self, self.headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', - 'Authorization': 'Bearer %s' % api_key + 'Authorization': 'Bearer %s' % api_key, + 'X-User-Agent': f'python-sdk {SDK_VERSION}' } @retry.Retry(predicate=retry.if_exception_type( diff --git a/setup.py b/setup.py index 4532e2563..0cbea9283 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,17 @@ import setuptools +with open('labelbox/__init__.py') as fid: + for line in fid: + if line.startswith('__version__'): + SDK_VERSION = line.strip().split()[-1][1:-1] + break + with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="labelbox", - version="2.4.9", + version=SDK_VERSION, author="Labelbox", author_email="engineering@labelbox.com", description="Labelbox Python API",