Skip to content

Commit 130a58b

Browse files
committed
Bugfixes, added function to find a Crownstone by UID.
1 parent beeed66 commit 130a58b

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

crownstone_cloud/lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Library that communicates with the Crownstone lib"""
22

3-
__version__ = '1.1.1'
3+
__version__ = '1.1.3'

crownstone_cloud/lib/cloud.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ def __init__(
2828
# data
2929
self.spheres: Optional[Spheres] = None
3030

31-
def __del__(self):
32-
self.reset()
33-
3431
async def initialize(self) -> None:
3532
"""Async initialize the cloud data"""
3633
if RequestHandler.access_token is None:
@@ -91,7 +88,6 @@ def get_crownstone_by_id(self, crownstone_id) -> Crownstone:
9188
def reset() -> None:
9289
"""Cleanup the request handler instance data"""
9390
RequestHandler.access_token = None
94-
RequestHandler.websession = None
9591
RequestHandler.login_data = None
9692

9793
@staticmethod

crownstone_cloud/lib/cloudModels/crownstones.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,16 @@ def find(self, crownstone_name: str) -> object or None:
6868
if crownstone_name == crownstone.name:
6969
return crownstone
7070

71-
return None
72-
7371
def find_by_id(self, crownstone_id) -> object or None:
7472
"""Search for a crownstone by id and return crownstone object if found"""
7573
return self.crownstones[crownstone_id]
7674

75+
def find_by_uid(self, crownstone_uid) -> object or None:
76+
"""Search for a crownstone by uid and return crownstone object if found"""
77+
for crownstone in self.crownstones.values():
78+
if crownstone_uid == crownstone.unique_id:
79+
return crownstone
80+
7781

7882
class Crownstone:
7983
"""Represents a Crownstone"""

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
from setuptools import setup, find_packages
22

3+
with open("README.md", "r") as fh:
4+
long_description = fh.read()
5+
36
setup(
4-
name='crownstone-lib-python-cloud',
5-
version='1.1.1',
7+
name='crownstone-cloud',
8+
version='1.1.3',
9+
long_description=long_description,
10+
long_description_content_type="text/markdown",
611
url='https://github.com/crownstone/crownstone-lib-python-cloud',
712
author='Crownstone B.V.',
8-
description='Async library to get & store data from the Crownstone cloud.',
913
packages=find_packages(exclude=['examples', 'tests']),
10-
platforms='any',
1114
install_requires=list(package.strip() for package in open('requirements.txt')),
1215
classifiers=[
1316
'Programming Language :: Python :: 3.7'
14-
]
17+
],
18+
python_requires='>=3.7',
1519
)

0 commit comments

Comments
 (0)