From 5e8fae3a9761bd603a580be57eb0058197d87f17 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 20 Feb 2018 15:12:26 -0700 Subject: [PATCH 01/11] upgrade travis python to 3.6 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c50862..5cca0f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -python: 3.5 +python: 3.6 env: # Avoid testing pypy on travis until the following issue is fixed: # https://github.com/travis-ci/travis-ci/issues/4756 From 4faf9bf112e77f4cb5eba1489377f45b3cd73320 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 20 Feb 2018 15:19:57 -0700 Subject: [PATCH 02/11] simplify test configuration, support python 3.6 and pypy3 --- .travis.yml | 21 +++++++++------------ setup.py | 1 + tox.ini | 27 ++++++--------------------- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cca0f6..67d8e3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,12 @@ language: python -python: 3.6 -env: - # Avoid testing pypy on travis until the following issue is fixed: - # https://github.com/travis-ci/travis-ci/issues/4756 - #- TOX_ENV=pypy - - TOX_ENV=py35 - - TOX_ENV=py34 - - TOX_ENV=py33 - - TOX_ENV=py27 - - TOX_ENV=docs +python: + - pypy + - pypy3.3-5.2-alpha1 + - 2.7 + - 3.3 + - 3.4 + - 3.5 install: - - pip install coveralls tox -script: tox -e $TOX_ENV + - pip install coveralls tox-travis +script: tox after_success: coveralls diff --git a/setup.py b/setup.py index c17939a..f931edb 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: PyPy' ), ) diff --git a/tox.ini b/tox.ini index 279b114..e19ff25 100644 --- a/tox.ini +++ b/tox.ini @@ -1,25 +1,10 @@ [tox] -envlist = pypy,py35,py34,py33,py27,docs +envlist = pypy,pypy3,py36-docs,py36,py35,py34,py33,py27 [testenv] -commands = coverage run --source=fitbit setup.py test +changedir = + docs: {toxinidir}/docs +commands = + py{py,py3,36,35,34,33,27}: coverage run --source=fitbit setup.py test + docs: sphinx-build -W -b html docs docs/_build deps = -r{toxinidir}/requirements/test.txt - -[testenv:pypy] -basepython = pypy - -[testenv:py35] -basepython = python3.5 - -[testenv:py34] -basepython = python3.4 - -[testenv:py33] -basepython = python3.3 - -[testenv:py27] -basepython = python2.7 - -[testenv:docs] -basepython = python3.4 -commands = sphinx-build -W -b html docs docs/_build From 41a7419852054c57e300f10dbf69fd3ef095739b Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 20 Feb 2018 15:23:55 -0700 Subject: [PATCH 03/11] whoops, add python 3.6 to travis matrix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 67d8e3a..219cc33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: - 3.3 - 3.4 - 3.5 + - 3.6 install: - pip install coveralls tox-travis script: tox From 6755500a1bb15aef16b1ae09a4b0579e8910313c Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 20 Feb 2018 15:31:51 -0700 Subject: [PATCH 04/11] fix docs test --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index e19ff25..5f471b4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = pypy,pypy3,py36-docs,py36,py35,py34,py33,py27 +envlist = pypy-test,pypy3-test,py36-test,py35-test,py34-test,py33-test,py27-test,py36-docs [testenv] changedir = docs: {toxinidir}/docs commands = - py{py,py3,36,35,34,33,27}: coverage run --source=fitbit setup.py test + test: coverage run --source=fitbit setup.py test docs: sphinx-build -W -b html docs docs/_build deps = -r{toxinidir}/requirements/test.txt From b8a8404ed394d5b10dc3c5063d27aaf1d16c9b2f Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Tue, 20 Feb 2018 15:36:10 -0700 Subject: [PATCH 05/11] fix docs test, part 2 --- tox.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tox.ini b/tox.ini index 5f471b4..f8a6d07 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,6 @@ envlist = pypy-test,pypy3-test,py36-test,py35-test,py34-test,py33-test,py27-test,py36-docs [testenv] -changedir = - docs: {toxinidir}/docs commands = test: coverage run --source=fitbit setup.py test docs: sphinx-build -W -b html docs docs/_build From 37eb7c9880334ee2690b71da0117d2359d0642a9 Mon Sep 17 00:00:00 2001 From: brad Date: Fri, 5 Oct 2018 09:04:41 -0600 Subject: [PATCH 06/11] drop support for Python 3.3 --- .travis.yml | 2 -- setup.py | 1 - tox.ini | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 219cc33..480e7a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ language: python python: - pypy - - pypy3.3-5.2-alpha1 - 2.7 - - 3.3 - 3.4 - 3.5 - 3.6 diff --git a/setup.py b/setup.py index f931edb..f5c4453 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,6 @@ 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', diff --git a/tox.ini b/tox.ini index f8a6d07..d47d1a1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pypy-test,pypy3-test,py36-test,py35-test,py34-test,py33-test,py27-test,py36-docs +envlist = pypy-test,py36-test,py35-test,py34-test,py27-test,py36-docs [testenv] commands = From 1392d12862da533119c45df7105a2020d280f810 Mon Sep 17 00:00:00 2001 From: brad Date: Fri, 5 Oct 2018 09:05:29 -0600 Subject: [PATCH 07/11] add pypy3.5 to test matrix --- .travis.yml | 1 + tox.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 480e7a0..ca39904 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: - pypy + - pypy3.5 - 2.7 - 3.4 - 3.5 diff --git a/tox.ini b/tox.ini index d47d1a1..71533b0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pypy-test,py36-test,py35-test,py34-test,py27-test,py36-docs +envlist = pypy-test,pypy3-test,py36-test,py35-test,py34-test,py27-test,py36-docs [testenv] commands = From 8f27805104063f6d3ef8f587b7b4b94c9724f4a0 Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Thu, 28 Feb 2019 10:39:17 -0800 Subject: [PATCH 08/11] pass client_secret kwarg to fetch method --- fitbit/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fitbit/api.py b/fitbit/api.py index ba9d037..1b458b1 100644 --- a/fitbit/api.py +++ b/fitbit/api.py @@ -143,6 +143,7 @@ def fetch_access_token(self, code, redirect_uri=None): self.access_token_url, username=self.client_id, password=self.client_secret, + client_secret=self.client_secret, code=code) def refresh_token(self): From df17c16aaae56593b9419ffe6d3a71c1d642deee Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Fri, 24 May 2019 08:57:05 -0700 Subject: [PATCH 09/11] version 0.3.1 --- CHANGELOG.rst | 4 ++++ fitbit/__init__.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index db75618..c3184fd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,7 @@ +0.3.1 (2019-05-24) +================== +* Fix auth with newer versions of OAuth libraries while retaining backward compatibility + 0.3.0 (2017-01-24) ================== * Surface errors better diff --git a/fitbit/__init__.py b/fitbit/__init__.py index a19bb4a..0368d08 100644 --- a/fitbit/__init__.py +++ b/fitbit/__init__.py @@ -3,7 +3,7 @@ Fitbit API Library ------------------ -:copyright: 2012-2017 ORCAS. +:copyright: 2012-2019 ORCAS. :license: BSD, see LICENSE for more details. """ @@ -17,8 +17,8 @@ __copyright__ = 'Copyright 2012-2017 ORCAS' __license__ = 'Apache 2.0' -__version__ = '0.3.0' -__release__ = '0.3.0' +__version__ = '0.3.1' +__release__ = '0.3.1' # Module namespace. From 2f00d77612b588e3dd56f0aaa73051cdba9ee65b Mon Sep 17 00:00:00 2001 From: Brad Pitcher Date: Fri, 24 May 2019 09:09:39 -0700 Subject: [PATCH 10/11] add pypi badge --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 90797ba..e1a576d 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ python-fitbit ============= +.. image:: https://badge.fury.io/py/fitbit.svg + :target: https://badge.fury.io/py/fitbit .. image:: https://travis-ci.org/orcasgit/python-fitbit.svg?branch=master :target: https://travis-ci.org/orcasgit/python-fitbit :alt: Build Status From 1692acad32ea0537d7ae5a467bff72fe41e05869 Mon Sep 17 00:00:00 2001 From: mtoshi Date: Mon, 12 Aug 2019 21:56:43 +0900 Subject: [PATCH 11/11] Add CherryPy server hostname and port control --- gather_keys_oauth2.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gather_keys_oauth2.py b/gather_keys_oauth2.py index aade911..39a19f8 100755 --- a/gather_keys_oauth2.py +++ b/gather_keys_oauth2.py @@ -6,6 +6,7 @@ import traceback import webbrowser +from urllib.parse import urlparse from base64 import b64encode from fitbit.api import Fitbit from oauthlib.oauth2.rfc6749.errors import MismatchingStateError, MissingTokenError @@ -28,6 +29,8 @@ def __init__(self, client_id, client_secret, timeout=10, ) + self.redirect_uri = redirect_uri + def browser_authorize(self): """ Open a browser to the authorization url and spool up a CherryPy @@ -36,6 +39,12 @@ def browser_authorize(self): url, _ = self.fitbit.client.authorize_token_url() # Open the web browser in a new thread for command-line browser support threading.Timer(1, webbrowser.open, args=(url,)).start() + + # Same with redirect_uri hostname and port. + urlparams = urlparse(self.redirect_uri) + cherrypy.config.update({'server.socket_host': urlparams.hostname, + 'server.socket_port': urlparams.port}) + cherrypy.quickstart(self) @cherrypy.expose