Skip to content

Commit f4f2c4d

Browse files
authored
Add user agent header to requests (#53)
1 parent d9d8834 commit f4f2c4d

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ What's New in the LabKey 2.4.0 package
88
- Add support for creating Freezer Manager freezer hierarchies via StorageController APIs
99
- earliest compatible LabKey Server version: 22.10.0
1010
- StorageWrapper: create_storage_item, update_storage_item, delete_storage_item
11+
- Set User-Agent header for requests to "LabKey Python API/<version>"
1112

1213
What's New in the LabKey 2.3.0 package
1314
==============================

labkey/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from labkey import domain, query, experiment, security, utils
17-
1816
__title__ = "labkey"
1917
__version__ = "2.4.0"
2018
__author__ = "LabKey"

labkey/server_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from labkey.utils import json_dumps
2+
from . import __version__
23
import requests
34
from requests.exceptions import RequestException
45
from labkey.exceptions import (
@@ -70,6 +71,7 @@ def __init__(
7071
self._api_key = api_key
7172
self._disable_csrf = disable_csrf
7273
self._session = requests.Session()
74+
self._session.headers.update({"User-Agent": f"LabKey Python API/{__version__}"})
7375

7476
if self._use_ssl:
7577
self._scheme = "https://"

0 commit comments

Comments
 (0)