Skip to main content

Python package to interact with Google Suite APIs

Project description

Google Suite

Python library to automate handling of various Google Suite APIs such as Gmail, Blogger, etc.

Setup

  • poetry install if you want some helpful tools poetry install --dev
  • poetry shell to enter the virtual environment
  • Make sure you have your Google token and credentials for your project from Google Cloud. You can follow the steps here to get started.

gmail.py

Quick overview of the methods:

Name Description Arguments
list_labels List of labels (returns a dict) None
create_label Creates a label label_name: str
update_label Updates a label label_name: str, new_label_name: str, label_visibility: LabelListVisibility, message_visibility: MessageListVisibility
delete_label Deletes a label label_name: str
label_by_id Gets a label by id label_name: str
label_by_name Gets a label by name msg_label_list: list
mark_read Marks an email as read by id msg_id: str
mark_all_read Marks all emails as read given a label or sender or both label_id: str = None, sender: str = None
mark_unread Marks an email as unread by id msg_id: str
list_messages List of messages None
send_message Sends a message that can have with or without an attachment. If provided a threadId it will also reply within the email thread chain. from_sender: str, to: str, subject: str, message_text: str, file: str = None, thread_id: str = None
download_attachment Downloads an attachment and puts it in the attachments directory. Returns the path of the attachment. Also marks the email as read label_name: str = None, sender: str = None
download_attachments Download attachments from a list of messages using a ThreadPool and puts it in the attachments directory. Returns the path of the attachment. Also marks the email as read messages: list[Message]
list_filters List of filters None
get_filter Get a filter by id filter_id: str
create_filter Creates a filter label_name: str = None, remove_from_inbox: bool = None, filter_from: str = None, subject: str = None, query: str = None, negatedQuery: str = None
update_filter Updates a filter label_name: str, new_label_name: str = None, label_visibility: LabelListVisibility = None, message_visibility: MessageListVisibility = None
delete_filter Deletes a filter filter_id: str

blogger.py

The blogger.py file contains methods to interact with the Blogger API:

Method Description Arguments
list_blogs Lists all blogs by the user. None
list_posts Lists all posts in a specific blog. None
get_post_content Retrieves the content of a specific post. post_id: str
search_post Searches for posts based on a query. query: str
insert_post Inserts a new post in the blog. title: str, content: str
delete_post_by_id Deletes a post by its ID. post_id: str
delete_post_by_title Deletes a post by its title. title: str
list_comments Lists comments for a specific post. post_id: str
get_comment_by_id Retrieves a comment by its ID. post_id: str, comment_id: str
list_comments_by_blog Lists comments for the entire blog. None
mark_as_spam Marks a comment as spam. post_id: str, comment_id: str
mark_as_not_spam Marks a comment as not spam. post_id: str, comment_id: str

Utilizing the Service Object

The util.py file builds the service object to interact with the Google APIs. Ensure that the project is set up in the Google Cloud Platform, and the necessary permissions and correct access to the scopes for the APIs are granted.

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

google_suite-0.1.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_suite-0.1.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file google_suite-0.1.1.tar.gz.

File metadata

  • Download URL: google_suite-0.1.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.4.0

File hashes

Hashes for google_suite-0.1.1.tar.gz
Algorithm Hash digest
SHA256 653951495cbf8cedaf061666f5da86e9dfc889ac9d486b041e65d124c608a541
MD5 03b7a11db79c1fe8064dec64847d671c
BLAKE2b-256 9e651210f63c1810eddf7943bf4e2e66a91c24769fc44244fc82aa8a77743a22

See more details on using hashes here.

File details

Details for the file google_suite-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: google_suite-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.4.0

File hashes

Hashes for google_suite-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d20a414e937f1eecfc035b6be2a9a991bb0ad35a750fa4c10040393533f45deb
MD5 046f59020c6cfe22660a3f9b28a0f643
BLAKE2b-256 c193278f5e948f3cc1686acb81ba555c7ad3ada2543c06958e612316e5aebdec

See more details on using hashes here.

Supported by

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