All Projects → dermasmid → google-workspace

dermasmid / google-workspace

Licence: MIT license
A unofficial high level Python API wrapper for some of the productivity based Google APIs, that is focused on simplicity.

Programming Languages

python
115233 projects - #7 most used programming language

Projects that are alternatives of or similar to google-workspace

Gmvault
gmail backup software
Stars: ✭ 3,396 (+4489.19%)
Mutual labels:  oauth2, gmail
gmail-gitlab-filtering
Google Apps Script for Gmail to filter and sort email from GitLab
Stars: ✭ 84 (+13.51%)
Mutual labels:  gmail, gmail-api
Gam
command line management for Google Workspace
Stars: ✭ 2,558 (+3356.76%)
Mutual labels:  oauth2, google-workspace
elixir-gmail
A Gmail API client for Elixir
Stars: ✭ 46 (-37.84%)
Mutual labels:  gmail, gmail-api
SoundCloud-API
SoundCloud API wrapped into a bunch of classes. Built with Retrofit2 and RxJava2.
Stars: ✭ 63 (-14.86%)
Mutual labels:  wrapper, oauth2
schematics
Schematics for adding Okta Auth to your projects
Stars: ✭ 60 (-18.92%)
Mutual labels:  oauth2
okta-spring-security-5-example
Authentication with Spring Security 5 and Okta OIDC
Stars: ✭ 16 (-78.38%)
Mutual labels:  oauth2
lumen-oauth2
OAuth2 module for the Lumen PHP framework.
Stars: ✭ 29 (-60.81%)
Mutual labels:  oauth2
XUSG
XUSG, XU's supreme graphics lib, is a handy wrapper currently for DirectX 12. It can be a good reference for designing your own DX12 wrapper APIs.
Stars: ✭ 57 (-22.97%)
Mutual labels:  wrapper
oauthproxy
This is an oauth2 proxy server
Stars: ✭ 32 (-56.76%)
Mutual labels:  oauth2
php-google-spreadsheet-api
PHP library for read/write access to Google spreadsheets via the version 3 API.
Stars: ✭ 38 (-48.65%)
Mutual labels:  oauth2
v-cupertino
A Vue 3 Wrapper for Cupertino Pane Library
Stars: ✭ 17 (-77.03%)
Mutual labels:  wrapper
disauth
📖 A Discord OAuth2 PHP class.
Stars: ✭ 12 (-83.78%)
Mutual labels:  oauth2
harfbuzz rs
A fully safe Rust wrapper for the harfbuzz text shaping library.
Stars: ✭ 26 (-64.86%)
Mutual labels:  wrapper
sharon
A lightweight and modular social sharing library
Stars: ✭ 16 (-78.38%)
Mutual labels:  gmail
HerePy
A library that provides a Python interface to the HERE APIs.
Stars: ✭ 73 (-1.35%)
Mutual labels:  wrapper
emailpyspam
A python 3+ program to spam emails to a list of users repetitively
Stars: ✭ 63 (-14.86%)
Mutual labels:  gmail
PSEventViewer
PSEventViewer (Get-Events) is really useful PowerShell wrapper around Get-WinEvent. One of the features you may be interested in is a simple way of getting “hidden” events data
Stars: ✭ 74 (+0%)
Mutual labels:  wrapper
moGL
Modern OpenGL wrapper, thin C++14 header-only layer on top of the OpenGL 4.5+ API
Stars: ✭ 27 (-63.51%)
Mutual labels:  wrapper
native-java-examples
Native Java Apps with Micronaut, Quarkus, and Spring Boot
Stars: ✭ 44 (-40.54%)
Mutual labels:  oauth2

Google Workspace

Google Workspace is a high level unofficial API wrapper for some of the productivity related Google API's. This library has for now only implemented a client for Gmail, I hope to add Drive and much more in the near future.

Installation

You can install from pypi:

pip install -U google-workspace

Or get the latest updates (Not recommended for production):

pip install -U git+https://github.com/dermasmid/google-workspace.git

Documentation

Take a look at the full documentation here https://google-workspace.readthedocs.io/

Getting project credentials

You need to get a client secret file from the google console and you need to enable the api you want to use, just Google it.

After you saved the credentials json file to your workdir - you are all set!

Quick start's

Here you can see a few samples to get a feel of whats ahead.

Authenticate on your local machine

This snippet will run a authentication flow using the local_oauth method.

import google_workspace

service = google_workspace.service.GoogleService(
    api="gmail",
    session="my-gmail",
    client_secrets="path/to/secrets/file"
    )
service.local_oauth()

gmail_client = google_workspace.gmail.GmailClient(service=service)
print(gmail_client.email_address)

Authenticate a remote user

This snippet will run a authentication flow using the url_oauth method.

import google_workspace

service = google_workspace.service.GoogleService(
    api="gmail",
    session="my-gmail",
    client_secrets="path/to/secrets/file"
    )

service.url_oauth(
    server_host="yourdomain.com",
    block=True
    )

gmail_client = google_workspace.gmail.GmailClient(service=service)
print(gmail_client.email_address)

Retrieve messages

This snippet will retrieve all messages from the inbox, print them to the console, mark them as read, and reply with a message saying "Hi!".

import google_workspace

gmail_client = google_workspace.gmail.GmailClient()

for message in gmail_client.get_messages("inbox"):
    print(message)
    message.mark_read()
    message.reply("Hi!")

Send html email with attachments

This snippet will send a html email with attachments and then delete it from your sent messages.

import google_workspace

gmail_client = google_workspace.gmail.GmailClient()
sent_message = gmail_client.send_message(
    to="[email protected]m",
    subject="This is fun!",
    html="<b>HTML here</b>",
    attachments=["image.png", "doc.pdf"]
    )
gmail_client.delete_message(sent_message.get("id"))

Forward incoming messages

This snippet will forward all incoming messages which have "python" in thier subject.

import google_workspace

gmail_client = google_workspace.gmail.GmailClient()

def message_filter(history):
    return "python" in history.message.subject

@gmail_client.on_message(labels="inbox", filters=[message_filter])
def handle_message(history):
    history.message.forward(to="[email protected]")

Feedback and contributing

This library is very focused on being easy and fun to use, so if you find something that you think can be improved please open an issue or even better, a PR, thank you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected]