本文整理汇总了Python中Message.extractEmails方法的典型用法代码示例。如果您正苦于以下问题:Python Message.extractEmails方法的具体用法?Python Message.extractEmails怎么用?Python Message.extractEmails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.extractEmails方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: findRoot
# 需要导入模块: import Message [as 别名]
# 或者: from Message import extractEmails [as 别名]
def findRoot(serviceGmail, serviceUser): # Edited by FH: uses the user
root = []
user = "me" # Use the user who authorized the call
userData = serviceUser.people().get(userId='me').execute()
query = 'in:sent'
try:
userEmail = userData['emails'][0]['value']
root.append(userEmail)
query = 'in:sent' + ' -' + userEmail
except:
pass
# max maxResults = 10
# response = Message.ListMessagesMatchingQuery(service, user, query)
response = serviceGmail.users().messages().list(userId=user, q=query, maxResults=1).execute()
numberOfMessages = response['resultSizeEstimate']
while numberOfMessages:
messageID = response['messages'][0]['id']
# extract the vFrom
msg = Message.GetMessage(serviceGmail, user, messageID)
for i in range(len(msg['payload']['headers'])):
name = msg['payload']['headers'][i]['name']
value = msg['payload']['headers'][i]['value']
if name == 'From':
vFrom = Message.extractEmails(value)
if vFrom[0] not in root:
root.append(vFrom[0])
print root
query = query + ' -' + vFrom[0]
response = serviceGmail.users().messages().list(userId=user, q=query).execute()
numberOfMessages = response['resultSizeEstimate']
return root