The piecemeal scripts for setting up XOAUTH2 for the two major XOAUTH providers are not particularly ergonomic.
This series collects them into a single tool, sasl-xoauth2-tool which has a subcommand syntax. The hope is that we can put sasl-xoauth2-tool as an executable into the user's $PATH to make it a little easier to operate.
The subcommand syntax is intended to leave room for any additional functionality that an admin might want or need, without needing to clutter the $PATH with more than one top-level name.
A few things to note about this series (i can change them if you prefer something different, though i think they're useful):
it's moved from optparse (which is probably going away) to argparse (credit to @jrollins for the heavy lifting here)
arguments like --client_id have been renamed to just use hyphens instead of underscores (now --client-id). this makes them not exactly match the values in the config file, but they feel more idiomatic to typical command line tooling.
the new script is all type-annotated, and it now passes mypy --strict
if the python argcomplete module is available, it should be pretty easy for distributors to generate bash tab completion directives for the tool (but argcomplete isn't required for the tool to run)
i've reverted from httplib2 to urllib.request so that the functionality doesn't depend on anything other than the python stdlib
Finally, I note that there is a placeholder test subcommand which currently raises a "Not Implemented" error. See #32 for more ideas about things we might populate that with.
The piecemeal scripts for setting up XOAUTH2 for the two major XOAUTH providers are not particularly ergonomic.
This series collects them into a single tool,
sasl-xoauth2-tool
which has a subcommand syntax. The hope is that we can putsasl-xoauth2-tool
as an executable into the user's $PATH to make it a little easier to operate.The subcommand syntax is intended to leave room for any additional functionality that an admin might want or need, without needing to clutter the $PATH with more than one top-level name.
A few things to note about this series (i can change them if you prefer something different, though i think they're useful):
optparse
(which is probably going away) toargparse
(credit to @jrollins for the heavy lifting here)--client_id
have been renamed to just use hyphens instead of underscores (now--client-id
). this makes them not exactly match the values in the config file, but they feel more idiomatic to typical command line tooling.mypy --strict
argcomplete
module is available, it should be pretty easy for distributors to generate bash tab completion directives for the tool (butargcomplete
isn't required for the tool to run)httplib2
tourllib.request
so that the functionality doesn't depend on anything other than the python stdlibFinally, I note that there is a placeholder
test
subcommand which currently raises a "Not Implemented" error. See #32 for more ideas about things we might populate that with.