-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
134 fix psl args #135
134 fix psl args #135
Conversation
Add code to set modified time to now for newly downloaded PSL file to avoid multiple downloads per day.
Update domain.py
…ive placeholder variables and if/else statements.
# Write the arguments to a file for use by the trustymail library | ||
with open('env.json', 'w') as env: | ||
json.dump(args, env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worse than a monkey patch and a complete non-starter to me as it breaks the API of this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted; I'll make an adjustment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcdonnnj Thanks for the feedback. What are your thoughts on adding arguments (readonly, filename) to domain.get_psl and moving the call to get_psl to cli.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to look at the least destructive way to fix this as I believe the monkey patch may only be an issue for the CLI. This package is used in other projects so I lean very conservatively against breaking changes that are not strictly necessary.
🗣 Description
--psl-filename=FILENAME
and--psl-read-only
now work as advertised.Remove monkey patches in domain.py. Remove PublicSuffixListFilename / PublicSuffixListReadOnly initialization in __main__.py; set default values in docopt usage pattern to compensate. Pass filename and readonly as a json file between cli.py and domain.py.
Additionally, removed several constants/variables from cli.py that are no longer needed after updating usage pattern. Trustymail now prints the docopt args dictionary. This is useful for confirming the default values are being used (feel free to remove this after testing).
💭 Motivation and context
This closes issue #134
🧪 Testing
pip install git+https://github.com/Matthew-Grayson/trustymail@134-fix-psl-args
trustymail cisa.gov
trustymail --psl-filename=testfilename.dat cisa.gov
python3 -c "from os import utime; os.utime('testfilename.dat', (1330712280, 1330712292))"
trustymail --psl-filename=testfilename.dat --psl-read-only cisa.gov
trustymail --psl-filename=testfilename.dat cisa.gov
✅ Pre-approval checklist
in code comments.
to reflect the changes in this PR.
✅ Pre-merge checklist
✅ Post-merge checklist