Interface to Google Cloud Storage
Project description
NQGCS
This package offers a pleasant interface to Google Cloud Storage.
Usage:
Create an NQGCS object
There are three ways. On Appengine, you can do simply:
from nqgcs import NQGCS
nqgcs = NQGCS()
You can do the above also if you use:
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
Otherwise, you can use a json key file. You can either pass the path to the file:
from nqgcs import NQGCS
nqgcs = NQGCS(json_key_path="your json key to gcs")
Or you can pass the file content, read via json:
from nqgcs import NQGCS
nqgcs = NQGCS(keys=keys)
Access GCS
Upload a file
with open("myfile", "r") as f:
nqgcs.upload("bucket name", "file name", f, type="text/plain")
Write a string to GCS
nqgcs.write("bucket name", "file name", "my content string", type="text/plain")
Read a string from GCS
s = nqgcs.read("bucket name", "file name")
Download a file from GCS
nqgcs.download("bucket name", "file name")
Delete a file, list files
nqgcs.delete("bucket name", "file name")
for f in nqgcs.listfiles("bucket_name", maximum=200):
print("The file name is:", f)
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
nqgcs-0.1.4.tar.gz
(3.6 kB
view hashes)
Built Distribution
nqgcs-0.1.4-py3-none-any.whl
(4.1 kB
view hashes)