diff --git a/.gitignore b/.gitignore index 93ed728..bb758af 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ bin/RunPowerWorkout.prg.debug.xml .DS_Store setup_env.sh upload_to_garmin_prev.py +*.ipynb \ No newline at end of file diff --git a/cicd/upload_to_garmin.py b/cicd/upload_to_garmin.py index bfe9266..3890129 100644 --- a/cicd/upload_to_garmin.py +++ b/cicd/upload_to_garmin.py @@ -17,6 +17,10 @@ BETA_APP = os.getenv("BETA_APP") DEV_EMAIL = os.getenv("DEV_EMAIL") +if GARMIN_USERNAME is None or GARMIN_PASSWORD is None: + print("Issue getting Garmin credentials") + exit(1) + try: release_notes = requests.get( f"https://api.github.com/repos/{'samueldumont' if BETA_APP == 'true' else 'tommyvdz'}/RunPowerWorkout/releases/tags/{TAG_NAME}" @@ -135,6 +139,11 @@ response = scraper.post(url, data=payload, headers=headers, params=querystring) print(f"Login result: {response.status_code}") +if response.status_code != 200: + print(f"{len(GARMIN_USERNAME)} {len(GARMIN_PASSWORD)}") + print(f"{response.text}") + exit(1) + ### UPLOAD FILE url = f"https://apps.garmin.com/en-US/developer/{DEV_ID}/apps/{STORE_ID}/update" @@ -156,8 +165,7 @@ "application/octet-stream", ), }, - boundary="----WebKitFormBoundary" - + "".join(random.sample(string.ascii_letters + string.digits, 16)), + boundary="----WebKitFormBoundary" + "".join(random.sample(string.ascii_letters + string.digits, 16)), ) headers = { @@ -562,8 +570,7 @@ ("betaApp", BETA_APP), ("submit", ""), ], - boundary="----WebKitFormBoundary" - + "".join(random.sample(string.ascii_letters + string.digits, 16)), + boundary="----WebKitFormBoundary" + "".join(random.sample(string.ascii_letters + string.digits, 16)), ) headers = { @@ -580,4 +587,4 @@ } response = scraper.post(url, headers=headers, data=m, allow_redirects=True) -print(f"What's new update result : {response.status_code}") \ No newline at end of file +print(f"What's new update result : {response.status_code}")