Skip to main content

pysuite: A data scientist's toolbox for Google Suite App

PyPI version codecov PyPI - Downloads

A python wrapper for Google Suite and Google Cloud Service API. This provides classes with user-friendly apis to operate with several Google API services. Currently, the supported services are:

For details on how to use pysuite, please view the documentation page

Get credentials

Credential files are necessary to access all Google Services supported in pysuite. There are two categories. Each requires its own credential file.

  • Google Suite: This includes Google Drive, Gmail and Spreadsheet.
  • Google Cloud: This includes Google Vision and Cloud Storage

Google Suite

You need to get a credential from Google API Console. The credential looks like:

{
  "installed": {
    "client_id": "xxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
    "project_id": "xxxxxxxxxxxxx-xxxxxxxxxxxx",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_secret": "xxxxxxxxxxxxxxxx",
    "redirect_uris": [
      "urn:ietf:wg:oauth:2.0:oob",
      "http://localhost"
    ]
  }
}

You can also provide a token json file if possible, the token file looks like:

{
     "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
     "refresh_token": "xxxxxxxxx"
}

If token file doesn't exist, a confirmation is needed from browser prompt. Then the token file will be created.

from pysuite import Authentication

credential_json_file = "/tmp/credential.json"
token_path_file = "/tmp/token.json"
client = Authentication(credential=credential_json_file, token=token_path_file, services="sheets")

Google Cloud Service

You need to get a credential json from Google Cloud. The credential looks like:

{
  "type": "service_account",
  "project_id": "your_project_id",
  "private_key_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "private_key": "-----BEGIN PRIVATE KEY-----xxxxxxxxxxx-----END PRIVATE KEY-----\n",
  "client_email": "some@email.address",
  "client_id": "xxxxxxxxxxxxxxxx",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xxxxxxxxx"
}

You can use Authentication class similarly. Note that token file is not needed for Cloud Service.

from pysuite import Authentication

credential_json_file = "/tmp/credential.json"
client = Authentication(credential=credential_json_file, token=None, services=["storage", "vision"])

Metadata

Release files for pysuite 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysuite 0.4.0
File Size Uploaded
pysuite-0.4.0.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysuite 0.4.0
File Interpreter ABI Platform
pysuite-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.2 kB

Release files / pysuite-0.4.0.tar.gz

Download URL pysuite-0.4.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
adfbcabae1bb1dc71b141fae325687537662ffe1b066450bf2fcbbe44783b578
BLAKE2b-256 checksum
How to use checksums
bff97e92e4d889efcf9219e03c79d6b0947e25ddeff20985fe0127bd811c1f2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

Release files / pysuite-0.4.0-py3-none-any.whl

Download URL pysuite-0.4.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbe2e562e11cb277c561e060cc4ad1102baebafb2dafda866a0b791ae20604ab
BLAKE2b-256 checksum
How to use checksums
c0408c43cba3e962408a103968a1f69c2e3c4c2765352972c60caa431043e620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20200814 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page