Skip to content
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

Garmin sync error #504

Closed
shaonianche opened this issue Sep 26, 2023 · 24 comments
Closed

Garmin sync error #504

shaonianche opened this issue Sep 26, 2023 · 24 comments

Comments

@shaonianche
Copy link
Collaborator

shaonianche commented Sep 26, 2023

  • Garmin modified the interface verification

error

@app4g
Copy link

app4g commented Sep 26, 2023

same here.. :-(

@yihong0618
Copy link
Owner

yes we know that issue, will try to fix it these days

@yihong0618 yihong0618 pinned this issue Sep 26, 2023
@naosense
Copy link

今天刚出现的,昨天还是好的

@app4g
Copy link

app4g commented Sep 26, 2023

yes.. it was good yesterday. Many other packages also broken from some changes at Garmin

@yihong0618
Copy link
Owner

maybe need some big change, so we need to wait....

@yihong0618
Copy link
Owner

修复了,按照如下步骤实验

  • git pull
  • python -m pip install -U git+https://github.com/yihong0618/garth.git
  • get python run_page/garmin_sync.py ${email} ${password} if cn python run_page/garmin_sync.py ${email} ${password} --is-cn to get the secret_string
  • python run_page/garmin_sync.py ${secret_string} --is-cn
  • 修改 Actions 的 secret

@yihong0618
Copy link
Owner

按照我的能成功么?

@naosense
Copy link

按照我的能成功么?

可以了

@weaming
Copy link
Contributor

weaming commented Sep 27, 2023

可惜是 python 版本,ts 版本怎么修

@yihong0618
Copy link
Owner

一样啊,看懂代码其实是现在用 header 验证了 url 改了,不难修的

@misaka9981
Copy link

misaka9981 commented Sep 28, 2023

  • python run_page/garmin_sync.py ${email} ${password} --is-cn

Get 403 error when obtain secret_string by following command.

 python3 scripts/garmin_sync.py [email protected] xxx --is-cn 

httpcore.ConnectError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

The above exception was the direct cause of the following exception:

httpx.ConnectError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

During handling of the above exception, another exception occurred:

httpx.HTTPStatusError: 403 Client Error: Forbidden for url: https://connect.garmin.cn/proxy/activitylist-service/activities/search/activities?start=0&limit=100

/opt/homebrew/lib/python3.9/site-packages/httpx/_client.py:1778: UserWarning: Unclosed <httpx.AsyncClient object at 0x1077562b0>. See https://www.python-httpx.org/async/#opening-and-closing-clients for details.

@yihong0618
Copy link
Owner

just check it work fine here, and its based on https://github.com/matin/garth you can use this to check
its ssl error...please check internet, and ssl things

@zerosrat
Copy link

zerosrat commented Oct 4, 2023

@yihong0618

image
  • 换用了 scret 去请求 garmin 数据,当天没问题,第 2 天会有问题,怀疑是 secret 过期了?

  • code 这里是不是应该先获取 secret_string 再用实时获取的 secret 去请求数据呢?

@yihong0618
Copy link
Owner

@zerosrat 确实,我这里研究下。

@yihong0618
Copy link
Owner

yihong0618 commented Oct 4, 2023

@zerosrat 那样的话我害怕多次请求。。。。容易 ban 号,我研究下为什么
研究了一下,我觉得可以改成之前的账号密码形式。

@yihong0618
Copy link
Owner

@zerosrat 修复了,拉取最新代码就行

@efish2002
Copy link

requirements.txt 中添加了garth 出现下面的错误
image

@yihong0618
Copy link
Owner

requirements.txt 中添加了garth 出现下面的错误
image

需要大于 3.8

@efish2002
Copy link

python run_page/garmin_sync.py ${{ secrets.GARMIN_SECRET_STRING_CN }} --only-run --is-cn
secrets.GARMIN_SECRET_STRING_CN 这个是要在secret中自己定义吗? 格式是什么呢? “佳明的用户名 密码” 吗?
image

@shaonianche
Copy link
Collaborator Author

secrets.GARMIN_SECRET_STRING_CN 这个是要在secret中自己定义吗? 格式是什么呢?

是需要自己定义的,这是个使用用戶名密码获取的字符串。步骤参见下文:
#504 (comment)

@outcastveron
Copy link

本地获取secret的时候报错,麻烦看下

PS C:\Users\limia\Downloads\running_page-master\run_page> python get_garmin_secret.py ${[email protected]} ${XXXX} --is-cn
Traceback (most recent call last):
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\garth\http.py", line 127, in request
self.last_resp.raise_for_status()
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://sso.garmin.cn/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\limia\Downloads\running_page-master\run_page\get_garmin_secret.py", line 18, in
garth.login(options.email, options.password)
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\garth\http.py", line 148, in login
self.oauth1_token, self.oauth2_token = sso.login(*args, client=self)
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\garth\sso.py", line 79, in login
client.post(
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\garth\http.py", line 139, in post
return self.request("POST", *args, **kwargs)
File "C:\Users\limia\AppData\Local\Programs\Python\Python310\lib\site-packages\garth\http.py", line 129, in request
raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 401 Client Error: Unauthorized for url: https://sso.garmin.cn/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.cn%2Fsso%2Fembed

@efish2002
Copy link

secrets.GARMIN_SECRET_STRING_CN 这个是要在secret中自己定义吗? 格式是什么呢?

是需要自己定义的,这是个使用用戶名密码获取的字符串。步骤参见下文: #504 (comment)

成功了,谢谢

@shaonianche
Copy link
Collaborator Author

shaonianche commented Oct 7, 2023

本地获取secret的时候报错,麻烦看下

@outcastveron 检查一下您的用戶名密码是否正确,运行脚本的时候可以用引号包含一下用戶名密码
python get_garmin_secret.py "用戶名" "密码" --is-cn

@outcastveron
Copy link

@shaonianche 感谢回复,已经解决!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants