Skip to content

Release v0.3.2 #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ python:
- 3.4
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
install:
- pip install coveralls tox-travis
script: tox
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Lorenzo Mancini
David Grandinetti
Chris Streeter
Mario Sangiorgio
Volodymyr Spodaryk
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.3.2 (2021-09-02)
==================
* Fixed wrong conditions: `x not in list` instead of `not x in list`
* Replaced mutable arguments with immutable
* Extended list Python versions supporting

0.3.1 (2019-05-24)
==================
* Fix auth with newer versions of OAuth libraries while retaining backward compatibility
Expand Down
4 changes: 2 additions & 2 deletions fitbit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
__copyright__ = 'Copyright 2012-2017 ORCAS'
__license__ = 'Apache 2.0'

__version__ = '0.3.1'
__release__ = '0.3.1'
__version__ = '0.3.2'
__release__ = '0.3.2'

# Module namespace.

Expand Down
14 changes: 7 additions & 7 deletions fitbit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,14 @@ def _DELETE_COLLECTION_RESOURCE(self, resource, log_id):
response = self.make_request(url, method='DELETE')
return response

def _resource_goal(self, resource, data={}, period=None):
def _resource_goal(self, resource, data=None, period=None):
""" Handles GETting and POSTing resource goals of all types """
url = "{0}/{1}/user/-/{resource}/goal{postfix}.json".format(
*self._get_common_args(),
resource=resource,
postfix=('s/' + period) if period else ''
)
return self.make_request(url, data=data)
return self.make_request(url, data=data or {})

def _filter_nones(self, data):
filter_nones = lambda item: item[1] is not None
Expand Down Expand Up @@ -534,7 +534,7 @@ def time_series(self, resource, user_id=None, base_date='today',
if end_date:
end = self._get_date_string(end_date)
else:
if not period in Fitbit.PERIODS:
if period not in Fitbit.PERIODS:
raise ValueError("Period must be one of %s"
% ','.join(Fitbit.PERIODS))
end = period
Expand Down Expand Up @@ -569,7 +569,7 @@ def intraday_time_series(self, resource, base_date='today', detail_level='1min',
the detail-level is now (OAuth 2.0 ):
either "1min" or "15min" (optional). "1sec" for heart rate.
"""
if not detail_level in ['1sec', '1min', '15min']:
if detail_level not in ['1sec', '1min', '15min']:
raise ValueError("Period must be either '1sec', '1min', or '15min'")

url = "{0}/{1}/user/-/{resource}/date/{base_date}/1d/{detail_level}".format(
Expand Down Expand Up @@ -700,7 +700,7 @@ def get_meals(self):

def get_devices(self):
"""
https://dev.fitbit.com/docs/devices/#get-devices
https://dev.fitbit.com/docs/devices/#get-devices
"""
url = "{0}/{1}/user/-/devices.json".format(*self._get_common_args())
return self.make_request(url)
Expand Down Expand Up @@ -901,7 +901,7 @@ def _get_body(self, type_, base_date=None, user_id=None, period=None,
kwargs = {'type_': type_}
base_url = "{0}/{1}/user/{2}/body/log/{type_}/date/{date_string}.json"
if period:
if not period in Fitbit.PERIODS:
if period not in Fitbit.PERIODS:
raise ValueError("Period must be one of %s" %
','.join(Fitbit.PERIODS))
kwargs['date_string'] = '/'.join([base_date_string, period])
Expand All @@ -925,7 +925,7 @@ def get_friends_leaderboard(self, period):
"""
https://dev.fitbit.com/docs/friends/#get-friends-leaderboard
"""
if not period in ['7d', '30d']:
if period not in ['7d', '30d']:
raise ValueError("Period must be one of '7d', '30d'")
url = "{0}/{1}/user/-/friends/leaders/{period}.json".format(
*self._get_common_args(),
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from setuptools import setup

required = [line for line in open('requirements/base.txt').read().split("\n") if line != '']
required_test = [line for line in open('requirements/test.txt').read().split("\n") if not line.startswith("-r") and line != '']
required_test = [
line for line in open('requirements/test.txt').read().split("\n")
if not line.startswith("-r") and line != ''
]

fbinit = open('fitbit/__init__.py').read()
author = re.search("__author__ = '([^']+)'", fbinit).group(1)
Expand Down Expand Up @@ -38,6 +41,10 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: PyPy'
),
)