Closed mishaschwartz closed 7 months ago
Ok, here's the new usage:
CLI:
weaver processes -aC weaver.cli.CookieAuthHandler -aT 'auth=thecookievaluethattshouldbeincluded' --url https://example.com/weaver
Client
s = requests.Session()
# add cookies to the session
client = WeaverClient("https://example.com/weaver", auth=CookieAuthHandler(token=s.cookies.get_dict()))
Note that because I made the changes in the RequestAuthHandler as discussed:
It would be fine with adding a pre-check to RequestAuthHandler that skips request_auth call when the token/cookie is predefined in the handler
it is possible to send a token to the BearerAuthHandler as well in a similar way (if you have the bearer token already)
@mishaschwartz You can add yourself to the contributors list in https://github.com/crim-ca/weaver/blob/master/AUTHORS.rst if you desire.
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
d234e11
) 85.65% compared to head (e7e3670
) 85.66%. Report is 1 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@mishaschwartz FYI https://github.com/crim-ca/weaver/tree/5.1.0
@mishaschwartz Due to a CI issue with https://github.com/crim-ca/weaver/tree/5.1.0, I pushed another https://github.com/crim-ca/weaver/tree/5.1.1. The docker image for it should be ready soon.
Add
weaver.cli.SessionAuthHandler
class which uses the cookies stored in a pre-existingrequests.Session
instance to authenticate.Alternative to #597 as discussed in https://github.com/crim-ca/weaver/pull/597#discussion_r1480537709
Closes #597