Changeset fc7bbfc for gmail-contacts-to-vcf.py
- Timestamp:
- 02/24/12 08:50:43 (15 months ago)
- Branches:
- master
- Children:
- d949443
- Parents:
- 45222ed
- git-author:
- Aurélien Bompard <aurelien@…> (02/24/12 08:50:43)
- git-committer:
- Aurélien Bompard <aurelien@…> (02/24/12 08:50:43)
- File:
-
- 1 edited
-
gmail-contacts-to-vcf.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gmail-contacts-to-vcf.py
rd473bae rfc7bbfc 39 39 class Contacts(object): 40 40 41 def __init__(self, email, password ):41 def __init__(self, email, password, picsdir=None): 42 42 """ 43 43 Takes an email and password corresponding to a gmail account to … … 53 53 self.groups = {} 54 54 self.maingroup = None 55 self.picsdir = picsdir 56 if self.picsdir and not os.path.exists(self.picsdir): 57 os.makedirs(self.picsdir) 55 58 56 59 … … 173 176 contact.photo.encoding_param = "b" 174 177 contact.photo.type_param = "image/jpeg" 175 #with open("%s.jpg" % entry.title.text, "w") as img: 176 # img.write(hosted_image_binary) 178 if self.picsdir: 179 with open(os.path.join(self.picsdir, 180 "%s.jpg" % entry.title.text), "w") as img: 181 img.write(hosted_image_binary) 177 182 178 183 # IM … … 223 228 parser.add_option("-p", "--password") 224 229 parser.add_option("-f", "--filename", help="VCard file to write to") 230 parser.add_option("--pics", help="dump contact pictures in this folder") 225 231 opts, args = parser.parse_args() 226 232 while not opts.user: … … 240 246 241 247 try: 242 contacts = Contacts(opts.user, opts.password )248 contacts = Contacts(opts.user, opts.password, opts.pics) 243 249 except gdata.service.BadAuthentication: 244 250 print 'Invalid user credentials given.'
Note: See TracChangeset
for help on using the changeset viewer.
