def dosync(self): a = gmail_imap() l = a.search(time_filter = True) header = a.fetch_header(l) body= a.fetch_body(l) print body gp = gmail_parser(body, header) fromAddress = gp.parse_from(str(header)) subject = gp.parse_subject(str(header)) ms = [gp.get_body_html(body[id]) for id in gp.id] body = gp.get_body(ms[0]) jsonData = gp.call_api(body) gp.send_email(subject[0],fromAddress[0],jsonData)
date, receiver = email[sender] if sender not in d.keys(): d[sender] = 1 else: d[sender] += 1 if receiver not in d.keys(): d[receiver] = 1 else: d[receiver] += 1 return d # def __main__(): a = gmail_imap() l = a.search(x_gm_raw="is:starred", time_filter=False) header = a.fetch_header(l) body = a.fetch_body(l) gp = gmail_parser(body, header) """ ms = [gp.get_body_html(body[id]) for id in gp.id] pls = [gp.parse_from(str(body)) for body in ms] tbs = [gp.tag_insert(p,l, {"nest":"level"}) for (p,l) in pls] cls = [tb.replace('3D', '') for tb in tbs] sls = [gp.nest_slice(cl) for cl in cls] """