fixed polar auth
This commit is contained in:
@@ -75,14 +75,16 @@ def get_token(code):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
headers = { 'Authorization': 'Basic %s' % base64.b64encode(auth_string) }
|
headers = { 'Authorization': 'Basic %s' % base64.b64encode(auth_string) }
|
||||||
|
print(headers,'aa')
|
||||||
except TypeError:
|
except TypeError:
|
||||||
headers = { 'Authorization': 'Basic %s' % base64.b64encode(bytes(auth_string,'utf-8')) }
|
headers = { 'Authorization': 'Basic %s' % base64.b64encode(
|
||||||
|
bytes(auth_string,'utf-8')).decode('utf-8') }
|
||||||
|
|
||||||
response = requests.post("https://polarremote.com/v2/oauth2/token",
|
response = requests.post("https://polarremote.com/v2/oauth2/token",
|
||||||
data=post_data,
|
data=post_data,
|
||||||
headers=headers)
|
headers=headers)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
token_json = response.json()
|
token_json = response.json()
|
||||||
thetoken = token_json['access_token']
|
thetoken = token_json['access_token']
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
@@ -697,8 +697,6 @@ def rower_process_polarcallback(request):
|
|||||||
|
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
access_token, expires_in, user_id = polarstuff.get_token(code)
|
access_token, expires_in, user_id = polarstuff.get_token(code)
|
||||||
|
|
||||||
expirydatetime = timezone.now()+datetime.timedelta(seconds=expires_in)
|
expirydatetime = timezone.now()+datetime.timedelta(seconds=expires_in)
|
||||||
|
|||||||
Reference in New Issue
Block a user