1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# -*- coding: utf-8 -*-
# Author: Manuel de la Pena <manuel@canonical.com>
#
# Copyright 2011 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""Script that shows the qt gui."""
# pylint: disable=F0401, E1101
from txnamedpipes import reactor
reactor.install()
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from ubuntu_sso.main.windows import UbuntuSSOClient
def found(*args):
print "creds found", args
reactor.stop()
@inlineCallbacks
def main():
"""Perform a client request to be logged in."""
client = UbuntuSSOClient()
client = yield client.connect()
client.sso_cred.on_credentials_found_cb = found
yield client.sso_cred.register_to_signals()
creds = yield client.sso_cred.login_or_register_to_get_credentials('Ubuntu One',
'http://www.google.com',
'This is a test.', 0)
print "called ok"
if __name__ == '__main__':
main()
reactor.run()
|