Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getText(service, userId, msg_id):
- message = gmail_service.users().messages().get(userId='me', id=msg_id, format='full').execute()
- text = message.get('payload').get('parts')[0].get('body').get('data')
- if text:
- return base64.urlsafe_b64decode(text.encode('ASCII')).decode('utf-8')
- return message['snippet']
Add Comment
Please, Sign In to add comment