Skip to content

Commit 980f74e

Browse files
youngale-pingthingsSiverJohnjustinGilmer
authored
Updated old api for new metadata changes (#93)
Co-authored-by: Jonathon Ferrell <jonathon@pingthings.io> Co-authored-by: Justin Gilmer <16173348+justinGilmer@users.noreply.github.com>
1 parent 3722e5f commit 980f74e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
- name: Run pre-commit
37-
uses: pre-commit/action@v2.0.3
37+
uses: pre-commit/action@v3.0.1
3838
with:
3939
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}

btrdb/conn.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Imports
1616
##########################################################################
1717

18+
import importlib.metadata
1819
import json
1920
import logging
2021
import os
@@ -65,6 +66,11 @@ def __init__(self, addrportstr, apikey=None):
6566
The ``btrdb.connect`` method is a helper function to make connecting to the platform easier
6667
usually that will be sufficient for most users.
6768
"""
69+
warn(
70+
"This API is deprecated in favor of the pingthings_api, refer to your hub landing page for further documentation.",
71+
DeprecationWarning,
72+
stacklevel=2,
73+
)
6874
addrport = addrportstr.split(":", 2)
6975
# 100MB size limit ~ 2500 streams for 5000 points with each point being 64bit
7076
# 500MB size limit ~ 13K streams for 5000 points
@@ -126,6 +132,12 @@ def __init__(self, apikey, client_call_details):
126132
if client_call_details.metadata is not None:
127133
metadata = list(client_call_details.metadata)
128134
metadata.append(("authorization", "Bearer " + apikey))
135+
metadata.append(
136+
(
137+
"x-api-client",
138+
"btrdbpy-" + importlib.metadata.version("btrdb"),
139+
)
140+
)
129141
self.method = client_call_details.method
130142
self.timeout = client_call_details.timeout
131143
self.credentials = client_call_details.credentials

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ maintainers = [
1010
description = "Bindings to interact with the Berkeley Tree Database using gRPC."
1111
readme = "README.md"
1212
license = {file="LICENSE.txt"}
13-
requires-python = ">=3.7,<=3.10"
13+
requires-python = ">=3.7,<=3.12"
1414
classifiers = [
1515
'Development Status :: 5 - Production/Stable',
1616
'Intended Audience :: Developers',

0 commit comments

Comments
 (0)