Skip to main content

Google Mail Library

Project description

GoogleMailLibrary

Library Scope: GLOBAL

created: September 21, 2022 12:20 UTC8

Author: Francisco Quinola Jr. | email: francisco.quinola@mnltechnology.com

company: Spiralworks Technologies Inc

Contents:

Introduction

GoogleMailLibrary is a Robotframework Test Library for interfacing tests with Google Email using Google Mail API v1.

Installation

Option 1
Install using pypi, run:

pip install rf-googlemaillibrary

Option 2
With recent version of pip, it is possible to install directly from GitHub repository. To Install latest source from the master branch, use this command:

pip install git+https://github.com/MainSystemDev/GoogleMailLibrary.git

Please note that installation will take some time, because pip will clone the GoogleMailLibrary project to a temporary directory and then perform the installation.

Usage

To use GoogleMailLibrary in Robot Framework tests, the library needs to first be imported using the Library setting as any other library.

*** Settings ***
Documentation                         This is demo test script to show how GoogleMailLibrary Works

Library                               GoogleMailLibrary
...                                   scopes=['https://www.googleapis.com/auth/gmail.readonly']

Library                               String

Suite Setup                           Initialize Email
...                                   tokenFile=path/to/token.json

Force Tags                            gmail-api

*** Variables ***
# Sample id
# Should be a specific valid email id from an inbox from gmail to work.
${email_id}                           183a2a567gf2db7c

*** Test Cases ***
Get First Email In Inbox
    [Documentation]                   Get the first email in inbox and return raw data.
    ...                               Please refer to the link on the datas returned for raw
    ...                               https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message.FIELDS
    [Tags]                            gmail-api-1
    ${first_email_raw}                Parse First Email
    Log To Console                    ${first_email_raw}

Get Recent Id In Inbox
    [Documentation]                   Get the first email id in inbox.
    ...                               Please refer to the link on the datas returned for raw
    ...                               https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message.FIELDS
    [Tags]                            gmail-api-2
    ${recent_message_id_in_inbox}     Get First Id In Inbox
    Log To Console                    \n${recent_message_id_in_inbox}

Get Specific Id In Inbox
    [Documentation]                   Get the Specific email id in inbox.
    ...                               Please refer to the link on the datas returned for raw
    ...                               expecting an argument for specific email_id
    ...                               https://developers.google.com/gmail/api/reference/rest/v1/users.messages#Message.FIELDS
    [Tags]                            gmail-api-3
    ${specific_message_in_inbox}      Parse Email                        ${email_id}
    Log To Console                    \n${specific_message_in_inbox}

Delete Specific Mail
    [Documentation]                   Delete the specific email in inbox
    ...                               Please refer to the link on the datas returned for raw
    ...                               expecting an argument for specific email_id
    ...                               https://developers.google.com/gmail/api/reference/rest/v1/users.messages/delete
    [Tags]                            gmail-api-4
    Delete Message                    ${email_id}

Return Email Body Content
    [Documentation]                   Get the specific email in inbox
    ...                               Email format can be in plain text, rich text and html
    ...                               Converts the html content to a readable text
    ...                               expecting an argument for specific email_id
    [Tags]                            gmail-api-5
    ${body_content}                   Return Email Body Content        
    ...                               ${email_id}
    Log To Console                    \n${body_content}

Return Sender of Specific Email
    [Documentation]                   Get the specific email in inbox
    ...                               Return the specific sender of email
    [Tags]                            gmail-api-6
    ${sender}                         Return Sender Name            ${email_id}
    Log To Console                    \n${sender}

Generating Documentation

To Generate the keyword Documentation, simply run:

python -m robot.libdoc GoogleMailLibrary documentation.html

Note that the library must first be installed before generating a documentation.

Dependencies

Pypi - Html2text version
Pypi - google-api-python-client version
Pypi - Html2text version
Pypi - Html2text version
Pypi - Html2text version
Pypi - Html2text version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rf-googlemaillibrary-0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

rf_googlemaillibrary-0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file rf-googlemaillibrary-0.1.tar.gz.

File metadata

  • Download URL: rf-googlemaillibrary-0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.0

File hashes

Hashes for rf-googlemaillibrary-0.1.tar.gz
Algorithm Hash digest
SHA256 a7ccf572a72afac99677dce21a956c2369f3bf21e8a5c29d424440c67fa65f8a
MD5 c6de57afbb9f6e64bfbebfc915ef85b4
BLAKE2b-256 2cd277112bfa3a49304d5e41e87aafc7cdb4f8c7ccccb9c0874817e8565245a7

See more details on using hashes here.

File details

Details for the file rf_googlemaillibrary-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rf_googlemaillibrary-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e48eced2b9e187722cb1d5eefc0e9e3d2ffdff87483e25196a9fdd0b6be9300
MD5 4fb22de31b90d11fe0fda1ad4dcffaa0
BLAKE2b-256 baead2c2d324c8b1348345c1b4a8a3b2c0ec9ba34ef9dd4eef6c5486f3e31614

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page