3 from __future__ import with_statement
4 from __future__ import division
7 sys.path.insert(0,"../src")
13 import cStringIO as StringIO
17 import gvoice.backend as backend
20 _moduleLogger = logging.getLogger(__name__)
23 if __name__ == "__main__":
24 logging.basicConfig(level=logging.DEBUG)
31 b = backend.GVoiceBackend()
32 b.login(username, password)
33 data = b.get_csv_contacts()
34 with open("test.csv", "wb") as f:
37 with open("test.csv", "U") as f:
41 # used with the official gmail one returned by passing no export params
42 data = "".join(c for (i, c) in enumerate(data) if (i%2 == 0))[1:]
43 for attr in csv.DictReader(StringIO.StringIO(data)):
44 for name in attr.keys():
45 if not attr[name] or name is None:
48 if any(attr[name] for name in attr.keys() if "Phone" in name):