Skip to content

Minor bugfix and raise exception on failure #96

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 3 commits into
base: master
Choose a base branch
from
Open
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 fitbit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import json
import requests
from oauthlib.oauth2 import MissingTokenError

try:
from urllib.parse import urlencode
Expand All @@ -26,6 +27,7 @@ class FitbitOauth2Client(object):
authorization_url = "%s/oauth2/authorize" % AUTHORIZE_ENDPOINT
access_token_url = request_token_url
refresh_token_url = request_token_url
token = None

def __init__(self, client_id, client_secret,
access_token=None, refresh_token=None,
Expand Down Expand Up @@ -82,6 +84,8 @@ def make_request(self, url, data={}, method=None, **kwargs):
self.refresh_token()
auth = OAuth2(client_id=self.client_id, token=self.token)
response = self._request(method, url, data=data, auth=auth, **kwargs)
except MissingTokenError as e:
raise e
except:
pass

Expand Down