Comment 25 for bug 157488

Revision history for this message
Adnane Belmadiaf (daker) wrote :

Hi Philip/Timur

Launchpadlib allows to load credentials from a file, run the script before on your machine, it will open a browser and once you authorise it will generate some access_token/access_secret keys, then all you need is to upload the file to the server :

[1]
consumer_key = System-wide: Ubuntu (xxxx)
consumer_secret =
access_token = xxxxxxxxxxxxxxxxxxxxxxx
access_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

diff

--- jira_sync.py 2013-11-30 22:36:01.922959795 +0000
+++ jira.py 2013-11-30 22:35:15.126960992 +0000
@@ -20,6 +20,7 @@
 from dateutil import parser
 from jira.client import JIRA
 from launchpadlib.launchpad import Launchpad
+from launchpadlib.uris import LPNET_SERVICE_ROOT

 httplib2.debuglevel = 0
@@ -134,7 +135,15 @@

 def get_launchpad_bugs(project):
     project = project.lower()
- launchpad = Launchpad.login_with(project, 'production')
+ cachedir = 'cache'
+ credentials_filename = "credentials.txt"
+ launchpad = Launchpad.login_with(
+ u'YOUR APP',
+ service_root=LPNET_SERVICE_ROOT,
+ credentials_file=credentials_filename,
+ launchpadlib_dir=cachedir
+ )
+
     project = launchpad.projects[project]
     launchpad_bugs = project.searchTasks(status=["New", "Fix Committed",
                                                  "Invalid", "Won't Fix",
@@ -380,4 +389,5 @@
                          user=config.get('JIRA', 'user'),
                          password=config.get('JIRA', 'password'),
                          project=config.get('project', 'name'),
- project_key=config.get('JIRA', 'project_key'))
\ Pas de fin de ligne à la fin du fichier
+ project_key=config.get('JIRA', 'project_key'))
+