Adding support for coroutines for async ops through trampolines
[theonering] / hand_tests / abook.py
1 #!/usr/bin/python
2
3 import sys
4 sys.path.insert(0,"../src")
5 import logging
6 import pprint
7
8 import gvoice.backend as backend
9 import gvoice.addressbook as abook
10
11
12 def print_contacts():
13         logging.basicConfig(level=logging.DEBUG)
14
15         args = sys.argv
16         username = args[1]
17         password = args[2]
18
19         b = backend.GVoiceBackend()
20         b.login(username, password)
21         assert b.is_authed()
22
23         book = abook.Addressbook(b)
24         book.update()
25         for number in book.get_numbers():
26                 #pprint.pprint((number, book.get_contact_name(number), book.get_phone_type(number), book.is_blocked(number)))
27                 pprint.pprint(book._numbers[number])
28
29
30 def print_blank_names():
31         logging.basicConfig(level=logging.DEBUG)
32
33         args = sys.argv
34         username = args[1]
35         password = args[2]
36
37         b = backend.GVoiceBackend()
38         b.login(username, password)
39         assert b.is_authed()
40
41         book = abook.Addressbook(b)
42         book.update()
43         for number in book.get_numbers():
44                 if not book.get_contact_name(number):
45                         pprint.pprint(book._numbers[number])
46
47
48 if __name__ == "__main__":
49         if True:
50                 print_contacts()
51         else:
52                 print_blank_names()