Google Cloud Storage API client library
Project description
Google Cloud Storage allows you to store data on Google infrastructure with very high reliability, performance and availability, and can be used to distribute large data objects to users via direct download.
Quick Start
In order to use this library, you first need to go through the following steps:
Installation
Set up a Python development environment and install this library in a venv. venv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.
Make sure you’re using Python 3.7 or later, which includes venv by default. With venv, it’s possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
Supported Python Versions
Python >= 3.7
Deprecated Python Versions
Unsupported Python Versions
Python == 3.6: the last released version which supported Python 3.6 was google-cloud-storage 2.0.0, released 2022-01-12.
Python == 3.5: the last released version which supported Python 3.5 was google-cloud-storage 1.32.0, released 2020-10-16.
Python == 2.7: the last released version which supported Python 2.7 was google-cloud-storage 1.44.0, released 2022-01-05.
Mac/Linux
python -m venv env
source env/bin/activate
pip install google-cloud-storage
Windows
py -m venv env
.\env\Scripts\activate
pip install google-cloud-storage
Example Usage
# Imports the Google Cloud client library
from google.cloud import storage
# Instantiates a client
client = storage.Client()
# Creates a new bucket and uploads an object
new_bucket = client.create_bucket('new-bucket-id')
new_blob = new_bucket.blob('remote/path/storage.txt')
new_blob.upload_from_filename(filename='/local/path.txt')
# Retrieve an existing bucket
# https://console.cloud.google.com/storage/browser/[bucket-id]/
bucket = client.get_bucket('bucket-id')
# Then do other things...
blob = bucket.get_blob('remote/path/to/file.txt')
print(blob.download_as_bytes())
blob.upload_from_string('New contents!')
What’s Next
Now that you’ve set up your Python client for Cloud Storage, you can get started running Storage samples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for google-cloud-storage-2.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fe26f1381b30e3cc328f46e13531ca8525458f870c1e303c616bdeb7b7f5c66 |
|
MD5 | c56444c2225006cf75f2a16b760cd369 |
|
BLAKE2b-256 | 5adc40561187d4d0536a3a213d2cf83e70117bc7815137e963eb39b101a17948 |
Hashes for google_cloud_storage-2.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 973e7f7d9afcd4805769b6ea9ac15ab9df7037530850374f1494b5a2c8f65b6b |
|
MD5 | be0139ceac8f5334e6b005682fe5ca9f |
|
BLAKE2b-256 | c22ebded151e3de8bb381412e591fc52c30b929e041fee8b8a6106db0c155692 |