Python extracting mails with Gmail Api
<p>I am writing Python script which should extract mails from gmail.
I am using Gmail Api. The code is:</p>

<pre><code>def get_credentials():
    home_dir = os.path.expanduser('~')
    credential_dir = os.path.join(home_dir, '.credentials')
    if not os.path.exists(credential_dir):
        os.makedirs(credential_dir)
    credential_path = os.path.join(credential_dir,
                                   'gmail-python-quickstart.json')

    store = Storage(credential_path)
    credentials = store.get()
    if not credentials or credentials.invalid:
        flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
        flow.user_agent = APPLICATION_NAME
        if flags:
            credentials = tools.run_flow(flow, store, flags)
        else: # Needed only for compatibility with Python 2.6
            credentials = tools.run(flow, store)
        print('Storing credentials to ' + credential_path)
    return credentials

def main():
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('gmail', 'v1', http=http)

    results = service.users().threads().list(userId='me').execute()
    result = results.get('threads', [])
    for each in result:
        print(each['snippet']+"\n")
</code></pre>

<p>I receive about 200 character messages. As I read documentation
<a href="https://developers.google.com/gmail/api/v1/reference/users/messages" rel="nofollow">here</a>. I wanted to use "payload" and "body", but it seems like there is no such possibility as far as there is no value "payload". Any ideas how to get full message?</p>