Skip to content

Commit

Permalink
Bugfixes, added function to find a Crownstone by UID.
Browse files Browse the repository at this point in the history
  • Loading branch information
RicArch97 committed Jun 8, 2020
1 parent beeed66 commit 130a58b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crownstone_cloud/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Library that communicates with the Crownstone lib"""

__version__ = '1.1.1'
__version__ = '1.1.3'
4 changes: 0 additions & 4 deletions crownstone_cloud/lib/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def __init__(
# data
self.spheres: Optional[Spheres] = None

def __del__(self):
self.reset()

async def initialize(self) -> None:
"""Async initialize the cloud data"""
if RequestHandler.access_token is None:
Expand Down Expand Up @@ -91,7 +88,6 @@ def get_crownstone_by_id(self, crownstone_id) -> Crownstone:
def reset() -> None:
"""Cleanup the request handler instance data"""
RequestHandler.access_token = None
RequestHandler.websession = None
RequestHandler.login_data = None

@staticmethod
Expand Down
8 changes: 6 additions & 2 deletions crownstone_cloud/lib/cloudModels/crownstones.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ def find(self, crownstone_name: str) -> object or None:
if crownstone_name == crownstone.name:
return crownstone

return None

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

def find_by_uid(self, crownstone_uid) -> object or None:
"""Search for a crownstone by uid and return crownstone object if found"""
for crownstone in self.crownstones.values():
if crownstone_uid == crownstone.unique_id:
return crownstone


class Crownstone:
"""Represents a Crownstone"""
Expand Down
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
from setuptools import setup, find_packages

with open("README.md", "r") as fh:
long_description = fh.read()

setup(
name='crownstone-lib-python-cloud',
version='1.1.1',
name='crownstone-cloud',
version='1.1.3',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/crownstone/crownstone-lib-python-cloud',
author='Crownstone B.V.',
description='Async library to get & store data from the Crownstone cloud.',
packages=find_packages(exclude=['examples', 'tests']),
platforms='any',
install_requires=list(package.strip() for package in open('requirements.txt')),
classifiers=[
'Programming Language :: Python :: 3.7'
]
],
python_requires='>=3.7',
)

0 comments on commit 130a58b

Please sign in to comment.