Enhancement: Add login failure detection#23
Merged
j-andrews7 merged 1 commit intoj-andrews7:masterfrom Nov 8, 2022
esqew:login-failure-detection
Merged
Enhancement: Add login failure detection#23j-andrews7 merged 1 commit intoj-andrews7:masterfrom esqew:login-failure-detection
j-andrews7 merged 1 commit intoj-andrews7:masterfrom
esqew:login-failure-detection
Conversation
Owner
|
Missed this, thanks for the PR. I'll take try to test soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logging into KenPom with MechanicalSoup is a bit wonky in that the service seems to always return
200 OKstatus code even on a credential-related failure. This leads to confusion like in #15 where one might assume a login was successful as no exception was thrown, but downstream encounters issues trying to pull data requiring a valid session.On further inspection, it seems the difference the response for a successful login and an unsuccessful one (due to incorrect credentials) is that the
Set-Cookieresponse header returns aPHPSESSIDfor successful logins, and cookie invalidation information otherwise. As such, I've updatedutils.pyto look for the string"PHPSESSID="in the response header value forSet-Cookieand, in its absence, throw theLogging in to kenpom.com failedException. I've also added logic intotests/conftest.pyto ensure thatpytestaborts when the login fails (as most tests will begin failing without a successful login anyway).If you can, I could use some help testing this in verifying that everyone does indeed get a
Set-Cookie: "PHPSESSID=..."header on successful login before this gets merged in.