Wrap essential Google Cloud Platform functions to a python API
Set project credentials and list VM's by prefix
import os
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = "/Users/vadimskritskii/PycharmProjects/report/gcp/rock-embassy-279812-b252be8804df.json"
os.environ['FROM_LOCAL'] = 'false'
os.environ['GCP_BUCKET'] = 'bucket_name'
from python_wrap_gcp import manage_instance
manage_instance.list_gcp_instances('INTERNAL_IP', prefix='cc-wiki')
Returns project VM's filtered by prefix as pandas.DataFrame
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
0 cc-wiki-1 us-central1-f e2-medium true 10.128.0.10 35.232.196.210 RUNNING
1 cc-wiki-2 us-central1-f e2-medium true 10.128.0.12 35.193.87.226 RUNNING
2 cc-wiki-3 us-central1-f e2-medium true 10.128.0.14 34.123.56.251 RUNNING
3 cc-wiki-4 us-central1-f e2-medium true 10.128.0.11 35.223.179.167 RUNNING
4 cc-wiki-5 us-central1-f e2-medium true 10.128.0.15 35.225.92.133 RUNNING
5 cc-wiki-6 us-central1-f e2-medium true 10.128.0.13 35.238.125.9 RUNNING```
Start all VM's by a prefix
manage_instance.manage_gcp_instance(action='start', prefix='cc-wiki')
[12:35:43.3]-[wrap_gcloud.py]-[wrap_gcloud_action]-[start: us-central1-f: cc-wiki-1,cc-wiki-2,cc-wiki-3,cc-wiki-4,cc-wiki-5,cc-wiki-6]-[I]-[9520cb]
Abstraction interface to read/write data either locally or on GCP
Load data from the bucket
import json
from python_wrap_gcp import io
data = json.loads(io.emulate_open("gs://meely-inventory/data/context.json"))
# alternatively
from python_wrap_gcp.reload_data import load_gcs_file
data, time_data_updated = load_gcs_file("gs://meely-inventory/data/context.json")
Save data locally
import json, os
from python_wrap_gcp import io
os.environ['TO_LOCAL'] = 'true'
context = {"hello": "witam",
"world": "świat"}
io.emulate_open("~/Desktop/context.json", method='wb', data=context)
Create VM's by creating a template & setting VM replicas
from meely_crawl.docs import config
from python_wrap_gcp.configure_gcp import configure
configure_gcp = configure.Configure(config.Path, config.GCPConfig)
configure_gcp.set_up()
Metadata
Release files for python-wrap-gcp 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-wrap-gcp-0.0.12.tar.gz | 11.2 kB | Without provenance | Details for python-wrap-gcp-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_wrap_gcp-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for python_wrap_gcp-0.0.12-py3-none-any.whl |
Total release size: 22.5 kB
Release files / python-wrap-gcp-0.0.12.tar.gz
| Download URL | python-wrap-gcp-0.0.12.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cfa56b860fd272fe3ff820c20fecdf51e193fe4ea558d2196a98703b9a298f76
|
|
BLAKE2b-256 checksum How to use checksums |
aae59b23663c15e2494e33b6f3499e2aeebfd9d287b594d755c2572ac667ba26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.36.1 importlib-metadata/4.11.3 keyring/18.0.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.4
|
Release files / python_wrap_gcp-0.0.12-py3-none-any.whl
| Download URL | python_wrap_gcp-0.0.12-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37ca80c064c5e5d534739cd26244b52665861e8cff049b738ed26422a166ceae
|
|
BLAKE2b-256 checksum How to use checksums |
c9d71a63374f36d2c0157f06c44e88395eebe6c5750f8887ff62b553cb744c96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.36.1 importlib-metadata/4.11.3 keyring/18.0.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.7.4
|
Security for python-wrap-gcp 0.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.