~bjornt/lp2kanban/no-sync-lanes

« back to all changes in this revision

Viewing changes to create_creds.py

  • Committer: Brad Crittenden
  • Date: 2012-12-10 15:28:53 UTC
  • mfrom: (58.1.1 junk)
  • Revision ID: bac@canonical.com-20121210152853-gtiu60cz9vx1b9nj
[r=bac] Add script and makefile target to create launchpadlib credentials for authenticated access.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import subprocess
 
4
import sys
 
5
 
 
6
from launchpadlib.credentials import Credentials
 
7
 
 
8
web_root="https://launchpad.net/"
 
9
 
 
10
creds = Credentials("tarmac")
 
11
url = creds.get_request_token(web_root=web_root)
 
12
 
 
13
subprocess.call(['xdg-open', url])
 
14
print("Once you have authenticated then press enter")
 
15
sys.stdin.readline()
 
16
creds.exchange_request_token_for_access_token(web_root=web_root)
 
17
 
 
18
f = open("credentials", "wb")
 
19
try:
 
20
    creds.save(f)
 
21
finally:
 
22
    f.close()