Skip to main content

A data scientist's toolbox for Google Suite Apps

Project description

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"])

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

pysuite-0.4.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

pysuite-0.4.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file pysuite-0.4.0.tar.gz.

File metadata

  • Download URL: pysuite-0.4.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pysuite-0.4.0.tar.gz
Algorithm Hash digest
SHA256 adfbcabae1bb1dc71b141fae325687537662ffe1b066450bf2fcbbe44783b578
MD5 58b8dd7c8cd789d962c24b842b27e5cc
BLAKE2b-256 bff97e92e4d889efcf9219e03c79d6b0947e25ddeff20985fe0127bd811c1f2e

See more details on using hashes here.

File details

Details for the file pysuite-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pysuite-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pysuite-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbe2e562e11cb277c561e060cc4ad1102baebafb2dafda866a0b791ae20604ab
MD5 7241370ed0e7c738625863bb451d2de4
BLAKE2b-256 c0408c43cba3e962408a103968a1f69c2e3c4c2765352972c60caa431043e620

See more details on using hashes here.

Supported by

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