Google Cloud Storage Client

ルスランガリモフ

私はGCSで最初の一歩を踏み出します

まず、プロジェクトでサービスアカウントを作成し、jsonでキーファイルを取得しました

次に、このサンプルのようなスクリプトを書いてみました

だが...

from gcloud import storage

client = storage.Client.from_service_account_json('/path/to/keyfile.json')

bucket = client.get_bucket('enggeo')
# Then do other things...
blob = bucket.get_blob('/ETicket.pdf')
print blob.download_as_string()
blob2 = bucket.blob('/wtt.txt')
blob2.upload_from_filename(filename='/home/test2/.www/test')

そしてエラーが発生する

File "tt.py", line 3, in <module>
client = storage.Client.from_service_account_json('/path/to/keyfile.json')  # TODO: rel paths
File "/home/test2/lib/python2.7/site-packages/gcloud/client.py", line 64, in from_service_account_json
return cls(*args, **kwargs)
File "/home/test2/lib/python2.7/site-packages/gcloud/storage/client.py", line 53, in __init__
http=http)
File "/home/test2/lib/python2.7/site-packages/gcloud/client.py", line 181, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/home/test2/lib/python2.7/site-packages/gcloud/client.py", line 146, in __init__
raise ValueError('Project was not passed and could not be '

プロジェクトは合格せず、環境から判断できませんでした。

なにが問題ですか?

ルスランガリモフ

client = storage.Client.from_service_account_json( '/ path / to / keyfile.json'、 'project')

JSONClientの引数を指定する必要があります

https://googlecloudplatform.github.io/gcloud-python/stable/gcloud-api.html#gcloud.client.JSONClient

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

Issue with 'google.cloud.storage'. module has no attribute 'Client'

Google Appengine Cloud Storage

PHP Google Cloud Storage

Google Cloud Storage

Can not run empty AndroidStudio 0.8.14 project with google-cloud-storage client library

Google Cloud Storage ::制限

Load big file from Google Cloud Storage into Google Cloud Functions?

在 Google Cloud Build 中使用 Google Cloud Storage

Google Cloud Storage returning wrong identity

What is the Google Cloud Storage public read uri?

Google Cloud Storage認証の使用

Generating getServingUrl() in google cloud storage with NodeJs sdk

Google Cloud Storage - Knowing who uploaded

Snowflake Connection to Google Cloud Storage in Australia

Is it possible to upload files directly to the Google Cloud Storage?

How to initialize Google Cloud Storage with credentials

Moving Google Cloud Storage bucket to another project

gsutil zip directory on google cloud storage

Concat Avro files in Google Cloud Storage

Delete a file inside a folder in Google cloud storage

Google Cloud Storage Notification with Pub/Sub and docs

Accessing files from Google cloud storage in RStudio

Google Cloud Storage WebUIの制限

Google Takeout from G Suite Download from Google Cloud Storage

Google BigQuery, How to load data from google cloud storage to BigQuery

Google Cloud Storage、Compute Engine、InsufficientPermissionエラー

Struggling to read csv files from Google Cloud Storage bucket

Copy from Google Cloud Storage Bucket to S3 Bucket

Upload youtube-dl transcript into Google Cloud storage

TOP 一覧

  1. 1

    PictureBoxで画像のブレンドを無効にする

  2. 2

    レスポンシブウェブサイトの一番下にスティッキーなナビゲーションバーを作成するのに問題がある

  3. 3

    Rパッケージ「AppliedPredictiveModeling」のインストール中にエラーが発生しました

  4. 4

    Chromeウェブアプリのウェブビューの高さの問題

  5. 5

    HTTPヘッダー 'SOAPAction'の値はサーバーによって認識されませんでした

  6. 6

    Pythonを使用して、リストからデータを読み取り、特定の値をElasticsearchにインデックス付けするにはどうすればよいですか?

  7. 7

    C ++でのcURLとマルチスレッドの使用

  8. 8

    セレンのモデルダイアログからテキストを抽出するにはどうすればよいですか?

  9. 9

    tkinterウィンドウを閉じてもPythonプログラムが終了しない

  10. 10

    STSでループプロセス「クラスパス通知の送信」のループを停止する方法

  11. 11

    Spring @ModelAttributeモデルフィールドマッピング

  12. 12

    Python / SciPyのピーク検出アルゴリズム

  13. 13

    Ansibleで複数行のシェルスクリプトを実行する方法

  14. 14

    テキストフィールドの値に基づいて UIslider を移動します

  15. 15

    tf.nn_conv2dとtf.nn.depthwise_conv2dの違い

  16. 16

    ZScalerと証明書の問題により、Dockerを使用できません

  17. 17

    MLでのデータ前処理の背後にある直感

  18. 18

    Postmanを使用してファイル付きの(ネストされた)jsonオブジェクトを送信する

  19. 19

    java.lang.NoClassDefFoundError:com / sun / istack / tools / DefaultAuthenticator $ Receiver

  20. 20

    Windows 10 Pro 1709を1803、1809、または1903に更新しますか?

  21. 21

    BLOBストレージからデータを読み取り、Azure関数アプリを使用してデータにアクセスする方法

ホットタグ

アーカイブ