releasing RP3 auto sync
This commit is contained in:
@@ -12,17 +12,35 @@ from iso8601 import ParseError
|
||||
|
||||
import pandas as pd
|
||||
|
||||
|
||||
import numpy
|
||||
import json
|
||||
from json.decoder import JSONDecodeError
|
||||
from uuid import uuid4
|
||||
|
||||
import logging
|
||||
|
||||
from rowsandall_app.settings import (
|
||||
GARMIN_CLIENT_KEY, GARMIN_REDIRECT_URI, GARMIN_CLIENT_SECRET
|
||||
)
|
||||
|
||||
from pytz import timezone as tz, utc
|
||||
|
||||
try:
|
||||
import http.client as http_client
|
||||
except ImportError:
|
||||
# Python 2
|
||||
import httplib as http_client
|
||||
http_client.HTTPConnection.debuglevel = 1
|
||||
|
||||
# You must initialize logging, otherwise you'll not see debug output.
|
||||
logging.basicConfig()
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
requests_log = logging.getLogger("requests.packages.urllib3")
|
||||
requests_log.setLevel(logging.DEBUG)
|
||||
requests_log.propagate = True
|
||||
|
||||
|
||||
from rowers.tasks import handle_get_garmin_file
|
||||
import django_rq
|
||||
queue = django_rq.get_queue('default')
|
||||
@@ -267,10 +285,30 @@ def ps_to_garmin(ps,r):
|
||||
signature_method='HMAC-SHA1'
|
||||
)
|
||||
|
||||
|
||||
url = 'https://apis.garmin.com/training-api/workout/'
|
||||
|
||||
|
||||
garminauth = OAuth1(
|
||||
client_key=oauth_data['client_id'],
|
||||
client_secret=oauth_data['client_secret'],
|
||||
resource_owner_key=r.garmintoken,
|
||||
resource_owner_secret=r.garminrefreshtoken,
|
||||
signature_method='HMAC-SHA1'
|
||||
)
|
||||
|
||||
|
||||
response = garmin.post(url,data=payload)
|
||||
|
||||
#POST /training-api/workout?undefined HTTP/1.1
|
||||
#Authorization: OAuth oauth_nonce="3347376452", oauth_signature="jM8%2BCsflDfmB6SGYFIEFa%2BKRBOU%3D", oauth_token="673806b7-aa7b-4064-8290-2dd1b0236ae6", oauth_consumer_key="ca29ba5e-6868-4468-987d-4ee60a1f04bf", oauth_timestamp="1616050850", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"
|
||||
#Host: apis.garmin.com
|
||||
#Accept: */*
|
||||
|
||||
#curl -v --header 'Authorization: OAuth oauth_nonce="3347376452", oauth_signature="jM8%2BCsflDfmB6SGYFIEFa%2BKRBOU%3D", oauth_token="673806b7-aa7b-4064-8290-2dd1b0236ae6", oauth_consumer_key="ca29ba5e-6868-4468-987d-4ee60a1f04bf", oauth_timestamp="1616050850", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"' 'https://apis.garmin.com/training-api/workout'
|
||||
|
||||
#Authorization: OAuth oauth_nonce="3347376452", oauth_signature="jM8%2BCsflDfmB6SGYFIEFa%2BKRBOU%3D", oauth_token="673806b7-aa7b-4064-8290-2dd1b0236ae6", oauth_consumer_key="ca29ba5e-6868-4468-987d-4ee60a1f04bf", oauth_timestamp="1616050850", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"
|
||||
|
||||
return response
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user