Private
Public Access
1
0

garmin work

This commit is contained in:
Sander Roosendaal
2021-05-05 16:31:18 +02:00
parent bf1bde95ad
commit 5fc274e834
2 changed files with 95 additions and 5 deletions

View File

@@ -35,11 +35,11 @@ from pytz import timezone as tz, utc
#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
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
@@ -305,6 +305,11 @@ def ps_to_garmin(ps,r):
payload['steps'] = lijst
url = 'https://apis.garmin.com/training-api/workout/'
print(payload)
print(oauth_data['client_id'])
print(oauth_data['client_secret'])
print(r.garmintoken)
print(r.garminrefreshtoken)
garmin = OAuth1Session(oauth_data['client_id'],
client_secret=oauth_data['client_secret'],
@@ -314,6 +319,8 @@ def ps_to_garmin(ps,r):
encoding='base64'
)
print(garmin.headers)
response = garmin.post(url,data=payload)
#POST /training-api/workout?undefined HTTP/1.1