Skip to content

Commit

Permalink
Add user agent to requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Sep 22, 2023
1 parent 7e88a4a commit 95a0b52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = singlestoredb
version = 0.8.7
description = Interface to the SingleStore database and cluster management APIs
description = Interface to the SingleStoreDB database and workspace management APIs
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/singlestore-labs/singlestoredb-python
Expand Down
3 changes: 3 additions & 0 deletions singlestoredb/http/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ class Connection(connection.Connection):
paramstyle = 'qmark'

def __init__(self, **kwargs: Any):
from .. import __version__ as client_version

connection.Connection.__init__(self, **kwargs)

host = kwargs.get('host', get_option('host'))
Expand All @@ -870,6 +872,7 @@ def __init__(self, **kwargs: Any):
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Encoding': 'compress,identity',
'User-Agent': f'SingleStoreDB-Python/{client_version}',
})

if kwargs.get('ssl_disabled', get_option('ssl_disabled')):
Expand Down
2 changes: 2 additions & 0 deletions singlestoredb/management/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(
self, access_token: Optional[str] = None, version: Optional[str] = None,
base_url: Optional[str] = None,
):
from .. import __version__ as client_version
access_token = (
access_token or
config.get_option('management.token')
Expand All @@ -41,6 +42,7 @@ def __init__(
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json',
'Accept': 'application/json',
'User-Agent': f'SingleStoreDB-Python/{client_version}',
})
self._base_url = urljoin(
base_url or type(self).default_base_url,
Expand Down

0 comments on commit 95a0b52

Please sign in to comment.