Provide a base class for scripts to use
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
launchpadlib |
Triaged
|
Low
|
Unassigned |
Bug Description
There should be a base class to use if you want to write a script that uses launchpadlib. I would want the class to set up a Launchpad instance for me, as well as provide options for which service root to use. Basically, a script for getting the display name of some people would look something like this:
"""
class MyScript(
consumer_name = 'my-script'
default_
def add_my_
def main(lp, args, options):
if options.output:
for person_name in args:
if options.output:
else:
if __name__ == '__main__':
script = MyScript()
sys.
"""
Now I should be able to call it using:
./my-script.py some-name
./my-script.py --output=
./my-script.py --service-
An important part is the last part, which allows me to specify the service-root. It's often desired to change this to run the script against either staging or production, but usually that involves changing the source code to do it. Having a base script class would make the scripts more usable by default. There are other default options that could be desired, for example which credential db to use, and which cache directory.
Changed in launchpadlib: | |
importance: | Undecided → Low |
status: | New → Triaged |
Check out python- launchpadlib- toolkit. I think it provides essentially what you're looking for.