Closed n8henrie closed 10 months ago
The rest looks good, but I only did a visual check. I didn't test the actual code (yet).
Thanks for looking
A few seemingly unrelated commits with nixos things in the beginning, which I ignored.
Yeah, old habits die hard.
Enums seem like a more correct way to provide discrete browser variants, and since they're easily available in Python for many versions now, I wanted to try passing an enum between functions internally instead of a string. This should provide much better type checking during development. As an additional advantage, any time it is necessary to accept a string from a user, this should be able to consolidate the parsing logic to a single location.
As StrEnum wasn't available until relatively late in the game, I used the "inherit from
str, Enum
" trick to allow easy comparisons:... though I don't think I'm leveraging this anywhere so a straight
Enum
withauto()
variants would likely have been fine.Added a deprecation warning for users passing in strings; it should be minimal friction to adapt code from
browser="chrome"
tobrowser=BrowserType("chrome")
orbrowser=BrowserType.CHROME
.This is partly in preparation for adding a CLI tool, which I hope to embark on soon (https://github.com/n8henrie/pycookiecheat/issues/60), and I intend to finally add some proper logging as well (https://github.com/n8henrie/pycookiecheat/issues/46)
Would appreciate any thoughts if you have time @grandchild!