Skip to content

Instantly share code, notes, and snippets.

View timrichardson's full-sized avatar

Tim Richardson timrichardson

  • GrowthPath
  • Melbourne, Australia
View GitHub Profile
@timrichardson
timrichardson / 0_ Gmail API for Service Accounts Python 2.7.
Last active April 28, 2020 19:21
Access gmail via gmail api, Service Account method (applicable if you have Google Apps admin access)
smtp mail sending in cPython blocks the GIL.
This code is tested on python 2.7.8 and I'm using it with web2py
If you use Google Apps for your domain email and if you have admin access, you can easily use the gmail api.
Because you have admin access, you can create a "service account" in the Google Developer Console.
This makes authentication easy.
There are other authorisation methods when you don't have admin access, but they require interaction from the user via a browser.
To use this, you need to install these modules (From PyPI):
pyOpenSSL
@timrichardson
timrichardson / KOUNTA_SAASU_EXPORT
Last active August 29, 2015 14:03
web-scraping technique to bulk export Kounta daily cash closings to Saasu. Currently there is no public Kounta API.
There is no API available for Kounta. Well, Kounta says there is one if you ask; I've asked a few times and was ignored.
This is a webscraping solution to mass exporting of daily takings reports into Saasu.