Improve TR log in handling and remove app login code#327
Improve TR log in handling and remove app login code#327RealCLanger wants to merge 2 commits intopytr-org:masterfrom
Conversation
|
@Felixoid would you mind having a look? |
Felixoid
left a comment
There was a problem hiding this comment.
Pretty straightforward changes with improved code. Some minor points to highlight 👍
|
|
||
| def payout(self, amount): | ||
| return self._sign_request("/api/v1/payout", {"amount": amount}).json() | ||
| return requests.request( |
There was a problem hiding this comment.
Should it be self._web_request? For other places as well
| if not self._weblogin: | ||
| payload_with_token["token"] = self.session_token | ||
|
|
||
| await ws.send(f"sub {subscription_id} {json.dumps(payload_with_token)}") |
There was a problem hiding this comment.
Looks like payload_with_token = payload.copy() is unnecessary now and here json.dumps(payload) can be used
| if not self._waf_token: | ||
| self._waf_token = self._fetch_waf_token() | ||
| self._set_waf_cookie(self._waf_token) |
There was a problem hiding this comment.
| if not self._waf_token: | |
| self._waf_token = self._fetch_waf_token() | |
| self._set_waf_cookie(self._waf_token) | |
| if not self._waf_token: | |
| self._waf_token = self._fetch_waf_token() | |
| if self._waf_token: | |
| self._set_waf_cookie(self._waf_token) |
I feel it should be under the condition. self._fetch_waf_token can return None
|
Tested PR #327 locally on macOS. Good news: it improved things enough that I got past the old Bad news: repeated attempts were still unstable:
I also verified that at one point only So PR #327 definitely helps, but for me login is still not reliably reproducible. |
This PR improves TR log in handling, fixes a few bugs and removes the app login.
In detail: