Created
October 21, 2015 00:26
-
-
Save tbreeds/4da3af2149f5a3711f51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import argparse | |
import codecs | |
import datetime | |
import locale | |
import os | |
import pytz | |
import sys | |
# import httplib2 | |
# httplib2.debuglevel = 1 | |
from launchpadlib.launchpad import Launchpad | |
CLIENT_NAME = 'Kaunchpad Comment Getter' | |
LP_INSTANCE = 'production' | |
CACHE_DIR = os.path.expanduser('~/.cache/launchpadlib/') | |
def main(bug_number, comment_number, verbose): | |
if not os.path.exists(CACHE_DIR): | |
print("Making %s" % CACHE_DIR) | |
os.makedirs(CACHE_DIR) | |
lp = Launchpad.login_anonymously(CLIENT_NAME, LP_INSTANCE, CACHE_DIR) | |
bug = lp.bugs[bug_number] | |
message=bug.messages[comment_number] | |
print(message.content) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description='Fetch bugs from launchpad') | |
parser.add_argument('-v', '--verbose', action="count", default=0, | |
help='Increase program verbosity') | |
parser.add_argument('bug_number', type=int, help="The bug number") | |
parser.add_argument('comment_number', type=int, help="The bug number") | |
args = parser.parse_args() | |
try: | |
main(args.bug_number, args.comment_number, args.verbose) | |
except KeyboardInterrupt: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment