Skip to content

Commit d554b6d

Browse files
chenqichenqi
authored andcommitted
Add Cloud Storage
1 parent 3a25cd7 commit d554b6d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

PageSpeedInsights/psi.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,17 @@ def test_run_pubsub(test_url):
5555
_test_url = "https://m.ctrip.com/webapp/flight/schedule/detail.html"
5656
test_run_http(_test_url)
5757
test_run_pubsub(_test_url)
58+
59+
60+
"""
61+
from google.cloud import storage
62+
client = storage.Client()
63+
# https://console.cloud.google.com/storage/browser/[bucket-id]/
64+
bucket = client.get_bucket('bucket-id-here')
65+
# Then do other things...
66+
blob = bucket.get_blob('remote/path/to/file.txt')
67+
print(blob.download_as_string())
68+
blob.upload_from_string('New contents!')
69+
blob2 = bucket.blob('remote/path/storage.txt')
70+
blob2.upload_from_filename(filename='/local/path.txt')
71+
"""

PageSpeedInsights/requirements.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Function dependencies
22
requests==2.21.0
3-
google-cloud-pubsub==0.40.0
3+
google-cloud-pubsub==0.40.0
4+
google-cloud-storage==1.15.0
5+
#google-cloud-bigtable==0.32.1
6+
#google-cloud-core==0.29.1

0 commit comments

Comments
 (0)