Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
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
Take a look at the full documentation here https://google-workspace.readthedocs.io/
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!
Here you can see a few samples to get a feel of whats ahead.
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)
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)
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!")
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="test@test.com",
subject="This is fun!",
html="<b>HTML here</b>",
attachments=["image.png", "doc.pdf"]
)
gmail_client.delete_message(sent_message.get("id"))
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="test@test.com")
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!
FAQs
A Python wrapper for the google workspace APIs
We found that google-workspace demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.