Closed Factual0367 closed 7 months ago
The same problem
Fixed in #54. The only thing that needs to change is the firefox version in the request header as that was too outdated
Thanks again @btw04 your fixes over the past few years have been terrific for those of us using the library long term but not familiar enough with the codebase to fix it ourselves. For those like me, before the pull request is merged in, you can just add the code that btw04 modified before the ticktickclient is initialized and this will overwrite the variables accordingly and seems to work for me. EG:
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0"
X_DEVICE_ = '{"platform":"web","os":"OS X","device":"Firefox 123.0","name":"unofficial api!","version":4531,' \
TickTickClient.HEADERS = {'User-Agent': USER_AGENT,
'x-device': X_DEVICE_}
For me at least, this is easier than editing the api.py file that's part of the library.
For me just patching headers didn't work, I needed to update the endpoint:
class TickTickClientPatched(TickTickClient):
def _login(self, username: str, password: str) -> None:
"""
Logs in to TickTick and sets the instance access token.
Arguments:
username: TickTick Username
password: TickTick Password
"""
url = self.BASE_URL + 'user/signon?wc=true&remember=true'
user_info = {
'username': username,
'password': password
}
parameters = {
'wc': True,
'remember': True
}
response = self.http_post(url, json=user_info, params=parameters, headers=self.HEADERS)
self.access_token = response['token']
self.cookies['t'] = self.access_token
client = TickTickClientPatched(
os.getenv("TICKTICK_USERNAME"), os.getenv("TICKTICK_PASSWORD"), auth_client
)
I am wondering about the policy of when to mark an issue as closed. One approach is to close the issue when the cause is known and a workaround is available. Another approach would be to only close it when code fixes are reflected in the version that new users install. The default in GitHub is that only open issues are displayed. A new user could install the app, have a problem then look into the list of open issues and not see the appropriate issue in GitHub. For this reason I favour the second approach of only closing the issue when code fixes are reflected in the version that new users install.
I have followed the instructions in the README. Although the auth-token is received successfully, authorization fails with error code 429. Any idea what the problem is?