{"id":13305722,"url":"https://github.com/dermasmid/google-workspace","last_synced_at":"2025-05-05T15:32:32.834Z","repository":{"id":57435388,"uuid":"293517203","full_name":"dermasmid/google-workspace","owner":"dermasmid","description":"A unofficial high level Python API wrapper for some of the productivity based Google APIs, that is focused on simplicity.","archived":false,"fork":false,"pushed_at":"2021-11-13T21:32:59.000Z","size":563,"stargazers_count":87,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T01:08:33.030Z","etag":null,"topics":["gmail","gmail-api","gmail-bot","google-workspace","oauth2","python","wrapper"],"latest_commit_sha":null,"homepage":"https://google-workspace.readthedocs.io/en/stable/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dermasmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-07T12:07:13.000Z","updated_at":"2025-03-23T22:06:10.000Z","dependencies_parsed_at":"2022-08-28T04:55:12.106Z","dependency_job_id":null,"html_url":"https://github.com/dermasmid/google-workspace","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dermasmid%2Fgoogle-workspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dermasmid%2Fgoogle-workspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dermasmid%2Fgoogle-workspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dermasmid%2Fgoogle-workspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dermasmid","download_url":"https://codeload.github.com/dermasmid/google-workspace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252524212,"owners_count":21762051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gmail","gmail-api","gmail-bot","google-workspace","oauth2","python","wrapper"],"created_at":"2024-07-29T17:54:00.217Z","updated_at":"2025-05-05T15:32:32.483Z","avatar_url":"https://github.com/dermasmid.png","language":"Python","readme":"# Google Workspace\n\n**Google Workspace** is a high level unofficial API wrapper for some of the productivity related Google API's.\nThis library has for now only implemented a client for Gmail, I hope to add Drive and much more in the near future.\n\n# Installation\n\nYou can install from pypi:\n\n``` bash\npip install -U google-workspace\n```\n\nOr get the latest updates (Not recommended for production):\n\n```bash\npip install -U git+https://github.com/dermasmid/google-workspace.git\n```\n\n# Documentation\n\nTake a look at the full documentation here [https://google-workspace.readthedocs.io/](https://google-workspace.readthedocs.io/)\n\n\n# Getting project credentials\n\nYou need to get a client secret file from [the google console](https://console.developers.google.com/) and you need to enable the api you want to use, just Google it.\n\nAfter you saved the credentials json file to your workdir - you are all set!\n\n\n# Quick start's\n\nHere you can see a few samples to get a feel of whats ahead.\n\n\n## Authenticate on your local machine\n\nThis snippet will run a authentication flow using the `local_oauth` method.\n\n```python\nimport google_workspace\n\nservice = google_workspace.service.GoogleService(\n    api=\"gmail\",\n    session=\"my-gmail\",\n    client_secrets=\"path/to/secrets/file\"\n    )\nservice.local_oauth()\n\ngmail_client = google_workspace.gmail.GmailClient(service=service)\nprint(gmail_client.email_address)\n\n```\n\n## Authenticate a remote user\n\nThis snippet will run a authentication flow using the `url_oauth` method.\n\n```python\nimport google_workspace\n\nservice = google_workspace.service.GoogleService(\n    api=\"gmail\",\n    session=\"my-gmail\",\n    client_secrets=\"path/to/secrets/file\"\n    )\n\nservice.url_oauth(\n    server_host=\"yourdomain.com\",\n    block=True\n    )\n\ngmail_client = google_workspace.gmail.GmailClient(service=service)\nprint(gmail_client.email_address)\n```\n\n## Retrieve messages\n\nThis snippet will retrieve all messages from the inbox, print them to the console,\nmark them as read, and reply with a message saying \"Hi!\".\n\n``` python\nimport google_workspace\n\ngmail_client = google_workspace.gmail.GmailClient()\n\nfor message in gmail_client.get_messages(\"inbox\"):\n    print(message)\n    message.mark_read()\n    message.reply(\"Hi!\")\n```\n\n## Send html email with attachments\n\nThis snippet will send a html email with attachments and then delete it from\nyour sent messages.\n\n```python\nimport google_workspace\n\ngmail_client = google_workspace.gmail.GmailClient()\nsent_message = gmail_client.send_message(\n    to=\"test@test.com\",\n    subject=\"This is fun!\",\n    html=\"\u003cb\u003eHTML here\u003c/b\u003e\",\n    attachments=[\"image.png\", \"doc.pdf\"]\n    )\ngmail_client.delete_message(sent_message.get(\"id\"))\n```\n\n## Forward incoming messages\n\nThis snippet will forward all incoming messages which have \"python\" in thier subject.\n\n```python\nimport google_workspace\n\ngmail_client = google_workspace.gmail.GmailClient()\n\ndef message_filter(history):\n    return \"python\" in history.message.subject\n\n@gmail_client.on_message(labels=\"inbox\", filters=[message_filter])\ndef handle_message(history):\n    history.message.forward(to=\"test@test.com\")\n```\n\n\n# Feedback and contributing\n\nThis library is very focused on being easy and fun to use, so if you find something that you think can be improved\nplease open an issue or even better, a PR, thank you!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdermasmid%2Fgoogle-workspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdermasmid%2Fgoogle-workspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdermasmid%2Fgoogle-workspace/lists"}